API

Function onPhysicsAfterStep

  • Registers a callback to run after each physics step, once dynamic body transforms have been synced back to their nodes and before the frame is rendered. Use this for per-step logic that must observe (or react to) the freshly-integrated state — e.g. tracking a marker to a body's post-step pose, or applying a force whose effect should integrate on the next step.

    Parameters

    • world: PhysicsWorld

      The physics world to hook.

    • cb: (timestep: number) => void

      Callback invoked with the world timestep (seconds) after each step.

    Returns void