|
Rapier C — 3D / f64 0.36.0+c.0
|
Create a world, configure integration, step, and serialize it. More...
Data Structures | |
| struct | R3IntegrationParameters |
| Plain configuration data; initialize defaults, edit, then apply. More... | |
Macros | |
| #define | R3_FRICTION_MODEL_SIMPLIFIED 0 |
| Friction model solving one Coulomb friction constraint per group of up to 4 contacts plus a twist constraint; faster but less accurate (default). | |
| #define | R3_FRICTION_MODEL_COULOMB 1 |
| Friction model solving one Coulomb friction constraint per contact point. | |
Typedefs | |
| typedef struct R3Bytes | R3Bytes |
| Immutable owned byte buffer. | |
| typedef struct R3World | R3World |
| Sole owner of simulation state. | |
| typedef struct R3IntegrationParameters | R3IntegrationParameters |
| Plain configuration data; initialize defaults, edit, then apply. | |
Functions | |
| struct R3IntegrationParameters | r3DefaultIntegrationParameters (void) |
| Return native default integration parameters. | |
| struct R3IntegrationParameters | r3IntegrationParameters (const struct R3World *world) |
| Return a copy of all world integration settings. | |
| R3Status | r3SetIntegrationParameters (struct R3World *world, const struct R3IntegrationParameters *data) |
| Copies validated values; does not expose a writable alias to Rust memory. | |
| size_t | r3ActiveRigidBodies (const struct R3World *world, struct R3RigidBodyHandle *buffer, size_t capacity) |
| Copies the island manager's active body handles. | |
| R3Real | r3TimeStep (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::dt. | |
| R3Status | r3SetTimeStep (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::dt. | |
| R3Real | r3MinCcdDt (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::minCcdDt. | |
| R3Status | r3SetMinCcdDt (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::minCcdDt. | |
| R3Real | r3LengthUnit (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::lengthUnit. | |
| R3Status | r3SetLengthUnit (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::lengthUnit. | |
| R3Real | r3WarmstartCoefficient (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::warmstartCoefficient. | |
| R3Status | r3SetWarmstartCoefficient (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::warmstartCoefficient. | |
| R3Real | r3NormalizedAllowedLinearError (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::normalizedAllowedLinearError. | |
| R3Status | r3SetNormalizedAllowedLinearError (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::normalizedAllowedLinearError. | |
| R3Real | r3NormalizedMaxCorrectiveVelocity (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::normalizedMaxCorrectiveVelocity. | |
| R3Status | r3SetNormalizedMaxCorrectiveVelocity (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::normalizedMaxCorrectiveVelocity. | |
| R3Real | r3NormalizedPredictionDistance (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::normalizedPredictionDistance. | |
| R3Status | r3SetNormalizedPredictionDistance (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::normalizedPredictionDistance. | |
| R3Real | r3NormalizedMaxLinearVelocity (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::normalizedMaxLinearVelocity. | |
| R3Status | r3SetNormalizedMaxLinearVelocity (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::normalizedMaxLinearVelocity. | |
| R3Real | r3NormalizedContactRecycleDistance (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::normalizedContactRecycleDistance. | |
| R3Status | r3SetNormalizedContactRecycleDistance (struct R3World *world, R3Real value) |
| Set the world setting documented by R3IntegrationParameters::normalizedContactRecycleDistance. | |
| size_t | r3NumSolverIterations (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::numSolverIterations. | |
| R3Status | r3SetNumSolverIterations (struct R3World *world, size_t value) |
| Set the world setting documented by R3IntegrationParameters::numSolverIterations. | |
| size_t | r3NumInternalPgsIterations (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::numInternalPgsIterations. | |
| R3Status | r3SetNumInternalPgsIterations (struct R3World *world, size_t value) |
| Set the world setting documented by R3IntegrationParameters::numInternalPgsIterations. | |
| size_t | r3NumInternalStabilizationIterations (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::numInternalStabilizationIterations. | |
| R3Status | r3SetNumInternalStabilizationIterations (struct R3World *world, size_t value) |
| Set the world setting documented by R3IntegrationParameters::numInternalStabilizationIterations. | |
| size_t | r3MaxCcdSubsteps (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::maxCcdSubsteps. | |
| R3Status | r3SetMaxCcdSubsteps (struct R3World *world, size_t value) |
| Set the world setting documented by R3IntegrationParameters::maxCcdSubsteps. | |
| R3Bool | r3ContactClustering (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::contactClustering. | |
| R3Status | r3SetContactClustering (struct R3World *world, R3Bool value) |
| Set the world setting documented by R3IntegrationParameters::contactClustering. | |
| R3Bool | r3ContactRecycling (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::contactRecycling. | |
| R3Status | r3SetContactRecycling (struct R3World *world, R3Bool value) |
| Set the world setting documented by R3IntegrationParameters::contactRecycling. | |
| R3Bool | r3FrictionInBiasPass (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::frictionInBiasPass. | |
| R3Status | r3SetFrictionInBiasPass (struct R3World *world, R3Bool value) |
| Set the world setting documented by R3IntegrationParameters::frictionInBiasPass. | |
| R3Bool | r3WarmstartJoints (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::warmstartJoints. | |
| R3Status | r3SetWarmstartJoints (struct R3World *world, R3Bool value) |
| Set the world setting documented by R3IntegrationParameters::warmstartJoints. | |
| struct R3SpringCoefficients | r3ContactSoftness (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::contactSoftness. | |
| R3Status | r3SetContactSoftness (struct R3World *world, struct R3SpringCoefficients value) |
| Set the world setting documented by R3IntegrationParameters::contactSoftness. | |
| struct R3SpringCoefficients | r3StaticContactSoftness (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::staticContactSoftness. | |
| R3Status | r3SetStaticContactSoftness (struct R3World *world, struct R3SpringCoefficients value) |
| Set the world setting documented by R3IntegrationParameters::staticContactSoftness. | |
| struct R3Vector | r3Gravity (const struct R3World *world) |
| Return the world-space gravitational acceleration. | |
| R3Status | r3SetGravity (struct R3World *world, struct R3Vector value) |
| Set the world-space gravitational acceleration. | |
| R3Status | r3Step (struct R3World *world, const struct R3PhysicsHooks *hooks, const struct R3EventCollector *events) |
| Advance simulation by one timestep. | |
| R3Status | r3DetectCollisions (struct R3World *world, const struct R3PhysicsHooks *hooks, const struct R3EventCollector *events) |
| Refresh collision detection without advancing simulation. | |
| struct R3ByteView | r3Bytes_Data (const struct R3Bytes *bytes) |
| Borrow snapshot bytes without copying; valid until r3FreeBytes. | |
| R3Status | r3FreeBytes (struct R3Bytes *bytes) |
| Release an owned snapshot byte buffer. | |
| struct R3Bytes * | r3SerializeWorld (const struct R3World *world) |
| Return owned snapshot bytes; release them with r3FreeBytes. | |
| struct R3World * | r3DeserializeWorld (const uint8_t *data, size_t count) |
| Restore ONLY trusted snapshots produced by the identical Rapier build. | |
| R3Status | r3SetNumThreads (struct R3World *world, size_t num_threads) |
| Configures a dedicated pool for this world's parallel work. | |
| R3Status | r3ClearThreadPool (struct R3World *world) |
| Removes the world's dedicated pool. | |
| size_t | r3NumThreads (const struct R3World *world) |
| Size of the world's dedicated pool, or zero if a parallel build has no dedicated pool configured. | |
| R3Status | r3SetCountersEnabled (struct R3World *world, R3Bool enabled) |
| Enable or disable the native pipeline profiling counters. | |
| double | r3StepTimeMs (const struct R3World *world) |
| Native engine time of the most recent step, in milliseconds, as in the Rust testbed. | |
| struct R3World * | r3DeserializeRigidState (const uint8_t *data, size_t count) |
| Read ONLY trusted legacy rigid-world snapshots from debug_deserialize3.rs, produced by the identical Rapier build. | |
| struct R3VolumeMeshParameters | r3NewVolumeMeshParameters (R3Real cell_size) |
| Return volume-meshing settings for the supplied cell size; this POD value requires no destructor. | |
| size_t | r3QuarantinedRigidBodies (const struct R3World *world, struct R3RigidBodyHandle *buffer, size_t capacity) |
| Copy the rigid bodies quarantined by the most recent Step because their pose or velocity became non-finite (NaN or infinite). | |
| size_t | r3QuarantinedColliders (const struct R3World *world, struct R3ColliderHandle *buffer, size_t capacity) |
| Copy the colliders quarantined by the most recent Step because their own pose or shape became non-finite, independently of their parent. | |
| size_t | r3QuarantinedSoftBodies (const struct R3World *world, struct R3SoftBodyHandle *buffer, size_t capacity) |
| Copy the soft bodies quarantined by the most recent Step because a particle position or velocity became non-finite. | |
| uint32_t | r3FrictionModel (const struct R3World *world) |
| Return the world setting documented by R3IntegrationParameters::frictionModel. | |
| R3Status | r3SetFrictionModel (struct R3World *world, uint32_t value) |
| Set the world setting documented by R3IntegrationParameters::frictionModel. | |
| struct R3World * | r3NewWorld (void) |
| Create an owned world. | |
| R3Status | r3FreeWorld (struct R3World *world) |
| Free a world. | |
Create a world, configure integration, step, and serialize it.
Setters change the named setting for subsequent operations.
| #define R3_FRICTION_MODEL_COULOMB 1 |
Friction model solving one Coulomb friction constraint per contact point.
| #define R3_FRICTION_MODEL_SIMPLIFIED 0 |
Friction model solving one Coulomb friction constraint per group of up to 4 contacts plus a twist constraint; faster but less accurate (default).
Immutable owned byte buffer.
Release with the matching FreeBytes function.
| typedef struct R3IntegrationParameters R3IntegrationParameters |
Plain configuration data; initialize defaults, edit, then apply.
No destructor.
Sole owner of simulation state.
Handles belong to the world that created them. Ordinary reads may overlap. A mutation or step requires exclusive access. Destruction must be externally synchronized with all users of this pointer.
| size_t r3ActiveRigidBodies | ( | const struct R3World * | world, |
| struct R3RigidBodyHandle * | buffer, | ||
| size_t | capacity ) |
Copies the island manager's active body handles.
| struct R3ByteView r3Bytes_Data | ( | const struct R3Bytes * | bytes | ) |
Borrow snapshot bytes without copying; valid until r3FreeBytes.
Never free the returned data pointer.
Removes the world's dedicated pool.
A parallel build then uses the calling context's Rayon pool (normally the global pool), not a single worker. Returns R3_UNSUPPORTED in a build without the parallel feature.
Return the world setting documented by R3IntegrationParameters::contactClustering.
Return the world setting documented by R3IntegrationParameters::contactRecycling.
| struct R3SpringCoefficients r3ContactSoftness | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::contactSoftness.
| struct R3IntegrationParameters r3DefaultIntegrationParameters | ( | void | ) |
Return native default integration parameters.
This POD value owns no resources.
| struct R3World * r3DeserializeRigidState | ( | const uint8_t * | data, |
| size_t | count ) |
Read ONLY trusted legacy rigid-world snapshots from debug_deserialize3.rs, produced by the identical Rapier build.
This is not a stable interchange format.
Import trusted legacy Rust testbed rigid-state bytes into a new owned world. Release with r3FreeWorld; see Snapshots.
| struct R3World * r3DeserializeWorld | ( | const uint8_t * | data, |
| size_t | count ) |
Restore ONLY trusted snapshots produced by the identical Rapier build.
Snapshots are not a stable file format.
| R3Status r3DetectCollisions | ( | struct R3World * | world, |
| const struct R3PhysicsHooks * | hooks, | ||
| const struct R3EventCollector * | events ) |
Refresh collision detection without advancing simulation.
Hooks and events may be NULL; events are appended to the collector.
Release an owned snapshot byte buffer.
NULL is allowed. Do not pass borrowed pointers or free the object twice.
Free a world.
NULL is allowed. Rejects destruction from an active callback. The caller must prevent other threads from starting calls during destruction.
Return the world setting documented by R3IntegrationParameters::frictionInBiasPass.
| uint32_t r3FrictionModel | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::frictionModel.
Return the world-space gravitational acceleration.
| struct R3IntegrationParameters r3IntegrationParameters | ( | const struct R3World * | world | ) |
Return a copy of all world integration settings.
Return the world setting documented by R3IntegrationParameters::lengthUnit.
| size_t r3MaxCcdSubsteps | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::maxCcdSubsteps.
Return the world setting documented by R3IntegrationParameters::minCcdDt.
| struct R3VolumeMeshParameters r3NewVolumeMeshParameters | ( | R3Real | cell_size | ) |
Return volume-meshing settings for the supplied cell size; this POD value requires no destructor.
| struct R3World * r3NewWorld | ( | void | ) |
Create an owned world.
Release it with FreeWorld.
Return the world setting documented by R3IntegrationParameters::normalizedAllowedLinearError.
Return the world setting documented by R3IntegrationParameters::normalizedContactRecycleDistance.
Return the world setting documented by R3IntegrationParameters::normalizedMaxCorrectiveVelocity.
Return the world setting documented by R3IntegrationParameters::normalizedMaxLinearVelocity.
Return the world setting documented by R3IntegrationParameters::normalizedPredictionDistance.
| size_t r3NumInternalPgsIterations | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::numInternalPgsIterations.
| size_t r3NumInternalStabilizationIterations | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::numInternalStabilizationIterations.
| size_t r3NumSolverIterations | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::numSolverIterations.
| size_t r3NumThreads | ( | const struct R3World * | world | ) |
Size of the world's dedicated pool, or zero if a parallel build has no dedicated pool configured.
Returns one for a build without the parallel feature.
| size_t r3QuarantinedColliders | ( | const struct R3World * | world, |
| struct R3ColliderHandle * | buffer, | ||
| size_t | capacity ) |
Copy the colliders quarantined by the most recent Step because their own pose or shape became non-finite, independently of their parent.
Rapier disabled them; re-enable them with Collider_SetEnabled once fixed. The list is cleared at the start of every Step and may hold handles removed since.
| size_t r3QuarantinedRigidBodies | ( | const struct R3World * | world, |
| struct R3RigidBodyHandle * | buffer, | ||
| size_t | capacity ) |
Copy the rigid bodies quarantined by the most recent Step because their pose or velocity became non-finite (NaN or infinite).
Rapier disabled them, restored their last valid pose when known, and zeroed their velocities and forces; re-enable them with RigidBody_SetEnabled once the cause is fixed. The list is cleared at the start of every Step and may hold handles removed since.
| size_t r3QuarantinedSoftBodies | ( | const struct R3World * | world, |
| struct R3SoftBodyHandle * | buffer, | ||
| size_t | capacity ) |
Copy the soft bodies quarantined by the most recent Step because a particle position or velocity became non-finite.
Rapier disabled them and zeroed their velocities but left the non-finite positions: fix them with SoftBody_SetParticlePosition before SoftBody_SetEnabled. The list is cleared at the start of every Step and may hold handles removed since.
Return owned snapshot bytes; release them with r3FreeBytes.
See Snapshots for restoration and handle lifetimes.
Set the world setting documented by R3IntegrationParameters::contactClustering.
Set the world setting documented by R3IntegrationParameters::contactRecycling.
| R3Status r3SetContactSoftness | ( | struct R3World * | world, |
| struct R3SpringCoefficients | value ) |
Set the world setting documented by R3IntegrationParameters::contactSoftness.
Enable or disable the native pipeline profiling counters.
Enabling returns R3_UNSUPPORTED if the library was built without the profiler feature.
Set the world setting documented by R3IntegrationParameters::frictionInBiasPass.
Set the world setting documented by R3IntegrationParameters::frictionModel.
Set the world-space gravitational acceleration.
| R3Status r3SetIntegrationParameters | ( | struct R3World * | world, |
| const struct R3IntegrationParameters * | data ) |
Copies validated values; does not expose a writable alias to Rust memory.
Set the world setting documented by R3IntegrationParameters::lengthUnit.
Set the world setting documented by R3IntegrationParameters::maxCcdSubsteps.
Set the world setting documented by R3IntegrationParameters::minCcdDt.
Set the world setting documented by R3IntegrationParameters::normalizedAllowedLinearError.
Set the world setting documented by R3IntegrationParameters::normalizedContactRecycleDistance.
Set the world setting documented by R3IntegrationParameters::normalizedMaxCorrectiveVelocity.
Set the world setting documented by R3IntegrationParameters::normalizedMaxLinearVelocity.
Set the world setting documented by R3IntegrationParameters::normalizedPredictionDistance.
Set the world setting documented by R3IntegrationParameters::numInternalPgsIterations.
Set the world setting documented by R3IntegrationParameters::numInternalStabilizationIterations.
Set the world setting documented by R3IntegrationParameters::numSolverIterations.
Configures a dedicated pool for this world's parallel work.
Zero selects Rayon's default. Takes effect on the next step. Reconfiguration must not race with a step or callback. Returns R3_UNSUPPORTED in builds without the parallel feature; keeps the previous pool when constructing the new one fails. The pool is not included in snapshots.
| R3Status r3SetStaticContactSoftness | ( | struct R3World * | world, |
| struct R3SpringCoefficients | value ) |
Set the world setting documented by R3IntegrationParameters::staticContactSoftness.
Set the world setting documented by R3IntegrationParameters::dt.
Set the world setting documented by R3IntegrationParameters::warmstartCoefficient.
Set the world setting documented by R3IntegrationParameters::warmstartJoints.
| struct R3SpringCoefficients r3StaticContactSoftness | ( | const struct R3World * | world | ) |
Return the world setting documented by R3IntegrationParameters::staticContactSoftness.
| R3Status r3Step | ( | struct R3World * | world, |
| const struct R3PhysicsHooks * | hooks, | ||
| const struct R3EventCollector * | events ) |
Advance simulation by one timestep.
Hooks and events may be NULL. Events are appended to the collector, which is never cleared automatically. This call invalidates all borrowed set-element pointers.
| double r3StepTimeMs | ( | const struct R3World * | world | ) |
Native engine time of the most recent step, in milliseconds, as in the Rust testbed.
Enable counters before stepping. Excludes C callbacks outside the step, rendering, and dispatch into a dedicated thread pool; remains unchanged while paused.
Return the world setting documented by R3IntegrationParameters::dt.
Return the world setting documented by R3IntegrationParameters::warmstartCoefficient.
Return the world setting documented by R3IntegrationParameters::warmstartJoints.