Skip to main content

live_poses

Function live_poses 

Source
fn live_poses(
    scope: &Scope<'_>,
    snapshot: &GamePhysics,
    poses: &mut Vec<(RenderEntity, Transform)>,
)
Expand description

The poses a tick publishes: one per shown ball, at the pose the physics snapshot names for its body. A ball the snapshot has not named yet is left out, keeping the transform the show job gave it.

A pose names the ball’s render instance, not the ball entity: the job that carries it runs in the render world, whose entities are its own. A ball entity from this world happens to share a number with some render entity, and writing a pose onto that one moves whatever it is.

A ball whose show job is queued counts as posed: both jobs travel the same queue in the order they were sent, so the show has put the instance in place before the pose reads it. Waiting for the show’s answer instead would cost the ball a tick of movement, and pose it one frame behind the drop.

The poses are the one buffer a tick does not keep: the job that carries them runs once in the render world and answers nothing, so the Vec moved into it never comes back. Everything else a tick reuses is a field.