Expand description
The rigid-body simulation, and the driver that runs it over a world.
Two halves that stay apart all the way down. The simulation is the solver:
the shapes, body parameters, joints, layer masks, and step results that
cross the boundary between a caller and the Simulation, plus the
PhysicsBudget a world reserves its bodies against. Everything crossing
that boundary is plain data in the engine’s [f32; 3] and Euler-degree
representation, addressed by an opaque BodyHandle. That is what lets the
simulation hold whatever math types it likes without those types reaching a
caller, and it names no engine domain type in either direction.
The driver around it builds a simulation from the world’s physics content at init, steps it on the fixed tick, and writes the results back as component data: prop bodies, character rigs, probes, contact shaping, and layer resolution. Where a module holds both halves they sit in separate files, never one.
Nothing here reads a clock, a file, or a device. The one thing only a host
can supply is threads, which it lends through PhysicsFanout; a world
with none steps on the calling thread.
Structs§
- Body
Handle - Opaque handle to a body inside a simulation.
- Character
Capsule - A character’s collision capsule: a cylinder of
2 * half_heightcapped by hemispheres ofradius, standing on the y axis. - Character
Move - Result of moving a character capsule for one tick.
- Character
Move Input - One character-capsule move request.
- Contact
Hit - One contact strong enough to pass the simulation’s force threshold.
- Dynamic
Params - Physical parameters for a dynamic (freely simulated) body.
- Inline
- The fan-out for a caller that has no threads to lend: every unit runs on the calling thread, in order.
- Joint
Motor - Velocity-driven motor parameters for a revolute or prismatic joint.
- Layer
Mask - Membership and filter bits applied to a collider or query.
- Physics
Budget - The reservation a world’s physics content implies.
- Physics
Counts - Tallies of a world’s authored physics content.
- Physics
System - Rigid-body simulation behavior. Constructed internally by
World::startfrom the world’sPhysicsConfig; never a declarable asset. - RayHit
- One raycast hit: the surface point, its outward normal, and the distance from the ray origin.
- Sensor
Crossing - One boundary crossing of a sensor region recorded during a step: something
began or stopped overlapping the sensor tagged
tag. - Serial
Fanout - The fan-out for a host with no threads to lend: every step runs on the calling thread.
- Shape
Cast - A shape swept through the world along a straight line.
- Shape
Cast Hit - What a
ShapeCastran into. - SimConfig
- Tuning for one simulation.
- Simulation
- A rigid-body simulation: bodies fall under gravity, collide, and come to rest.
Enums§
- Collider
Shape - A collision shape, in the body’s local space.
- Joint
Spec - Constraint shape connecting two bodies.
Constants§
- GRAVITY
- Acceleration due to gravity in world units per second squared. Shared with the third-person controller so its jump takeoff matches the rig’s fall.
Traits§
- Fanout
- A caller’s way of running independent work at the same time.
- Physics
Fanout - A host’s way of lending the simulation the threads it has.
Functions§
- euler_
deg_ from_ quat - Engine Euler degrees
[pitch, yaw, roll]for an[x, y, z, w]rotation quaternion, which need not be normalised. - quat_
from_ euler_ deg - The
[x, y, z, w]rotation quaternion for engine Euler degrees[pitch, yaw, roll], applied in YXZ order.