API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classPhysicsBinding

@codexo/exojs-physics / physics / stable

A link between a PhysicsBody and a SceneNode. The body's world position **and rotation** are written onto the node (the body's angle is radians; the node's rotation is degrees). The node must be world-space-rooted; runtime scale is ignored and non-zero skew is rejected at bind time. By default the node snaps to the latest fixed-step state after each step. With `PhysicsWorld`'s interpolation enabled the node is instead placed between the body's previous and current fixed states, which smooths motion when the fixed rate is below the frame rate. Either way this is presentation: nothing written onto the node is read back into the simulation.

2
props
2
methods
0
events
Import
import { PhysicsBinding } from '@codexo/exojs-physics'

A link between a PhysicsBody and a SceneNode. The body's world position **and rotation** are written onto the node (the body's angle is radians; the node's rotation is degrees). The node must be world-space-rooted; runtime scale is ignored and non-zero skew is rejected at bind time.

By default the node snaps to the latest fixed-step state after each step. With `PhysicsWorld`'s interpolation enabled the node is instead placed between the body's previous and current fixed states, which smooths motion when the fixed rate is below the frame rate. Either way this is presentation: nothing written onto the node is read back into the simulation.

Constructors1
Methods2
sync(): void
Write the body's current transform (position + rotation) onto the bound node.
syncInterpolated(alpha: number): void
Place the node alpha of the way from the body's previous fixed state to its current one. alpha is the host's leftover sub-step fraction, so 0 renders the state the last fixed step started from and values approaching 1 render the state it produced. A plain lerp is correct for the angle too: body angles are continuous and unbounded, never wrapped into a range, so there is no shortest-arc case to resolve.
Properties2
Source