tecs.physics.rapier
The Rapier implementation of the batched physics crossing.
Requiring this module binds the tecs_physics native library, so tecs.physics reaches it only when a world actually asks for the native solver. A world driven by a simulation its caller supplied never loads it.
The declarations below are the managed half of one ABI whose Rust half lives in native/rust/physics. Layout is positional, so the field order here has to match the Rust order exactly; assertLayout repeats every size the Rust layout_is_pinned test pins, and a mismatch fails the first time a game asks for physics rather than somewhere inside the solver.
Every command and result buffer belongs to this module. The native side borrows them for exactly the duration of one call and retains nothing, which is what makes the crossing free of foreign lifetimes. Reads and writes into those buffers sit inside unsafe do because the checker cannot see that an index this module bounds-checked against a capacity this module allocated is in range; every such block is preceded by the check that makes it true.
tecs.internal.nativelibrary runs before the declarations below and loads the library into the process namespace, which is what lets each cdef function name a symbol without naming a file.
Module contents
Functions
| Function | Kind | Description |
|---|---|---|
create | function | Creates a simulation backed by the native Rapier library. |
Functions#
createfunction#
function create(options: contract.Options?): contract.SimulationCreates a simulation backed by the native Rapier library.
Arguments
| Name | Type | Description |
|---|---|---|
options | contract.Options? | the gravity in meters per second squared, the substep count and the requested solver width |
Returns
| Type | Description |
|---|---|
contract.Simulation | the simulation, ready to receive queued commands |
Raises
when the native library cannot create a world