pub fn spawn_physics_world_with<R: WorldRunner>(
host: &mut World,
config: PhysicsConfig,
) -> WorldHandleExpand description
Spawn the physics world driven by R: on its own thread
(Threaded), or stepped by the host
(Stepped).
The world owns the rapier world as a PhysicsWorld component, and
gameplay never touches it: jobs build bodies, and a subscriber reads the
state back. The world is created before the first job runs, so a job that
builds a body — the static geometry, usually — finds it ready.
Nothing is published until someone subscribes: the world runs a
subscriber’s collector once per step, after the step has drained its
contacts. Subscribing with the handle’s JobSender
is how a host asks for transforms, contacts, or both.
Both runners share one tick body, so a stepped world simulates exactly
what a threaded one does: the only difference is that its host calls
crate::world::step_stepped_world once per frame instead of a thread
pacing itself.