SimulationBody
@zylem/game-lib / runtime / SimulationBody
Class: SimulationBody
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:40
Implements
PhysicsRenderPoseProvider
Constructors
Constructor
new SimulationBody(
simulation,handle,clock):SimulationBody
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:70
Parameters
simulation
handle
clock
Returns
SimulationBody
Properties
handle
readonlyhandle:EntityHandle
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:72
Methods
angvel()
angvel():
PhysicsVector3
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:120
Returns
PhysicsVector3
applyImpulse()
applyImpulse(
impulse,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:146
Parameters
impulse
PhysicsVector3
_wakeUp?
boolean = true
Returns
void
bodyType()
bodyType():
number
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:197
Returns
number
getPoseHistory()
getPoseHistory():
PhysicsPoseHistory
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:246
Returns
PhysicsPoseHistory
Implementation of
PhysicsRenderPoseProvider.getPoseHistory
getRenderPose()
getRenderPose(
alpha):PhysicsPose
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:263
Parameters
alpha
number
Returns
PhysicsPose
Implementation of
PhysicsRenderPoseProvider.getRenderPose
isEnabled()
isEnabled():
boolean
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:209
Returns
boolean
isRenderSleeping()
isRenderSleeping():
boolean
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:272
True when the latest render buffer marks this body as sleeping. Used by instancing to skip matrix writes for settled piles.
Returns
boolean
isSleeping()
isSleeping():
boolean
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:205
Returns
boolean
linvel()
linvel():
PhysicsVector3
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:114
Returns
PhysicsVector3
lockRotations()
lockRotations(
locked,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:157
Rotation locks are fixed at body-creation time in the wasm runtime
(SimulationBodyDefinition.lockRotation); there is no live setter FFI
yet. Accepted for Rapier compat — when locking, the angular velocity is
zeroed to approximate the intent. Prefer lock flags on the body
definition at spawn time.
Parameters
locked
boolean
_wakeUp?
boolean = true
Returns
void
lockTranslations()
lockTranslations(
locked,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:170
Translation locks are fixed at body-creation time in the wasm runtime
(SimulationBodyDefinition.lockTranslation); there is no live setter
FFI yet. Accepted for Rapier compat — when locking, the linear velocity
is zeroed to approximate the intent. Prefer lock flags on the body
definition at spawn time.
Parameters
locked
boolean
_wakeUp?
boolean = true
Returns
void
markPoseDiscontinuity()
markPoseDiscontinuity():
void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:87
Suppress interpolation until the render buffers catch up.
Called automatically by the pose setters below. Wasm-side behaviors that
teleport a body during a step (e.g. screen_wrap) bypass those setters,
so their host systems must call this after the step and before render
poses are synced — otherwise the render buffers straddle the teleport and
the body is drawn sweeping between the two poses.
Returns
void
mass()
mass():
number
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:201
Returns
number
rotation()
rotation():
PhysicsQuaternion
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:103
Returns
PhysicsQuaternion
setAngvel()
setAngvel(
velocity,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:142
Parameters
velocity
PhysicsVector3
_wakeUp?
boolean = true
Returns
void
setGravityScale()
setGravityScale(
_scale,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:189
Gravity scale is fixed at body-creation time in the wasm runtime; there is
no live setter FFI yet, so this is accepted for Rapier compat but has no
effect. Prefer gravityScale on the body definition at spawn time when
possible.
Parameters
_scale
number
_wakeUp?
boolean = true
Returns
void
setLinearDamping()
setLinearDamping(
_damping):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:181
Damping is fixed at body-creation time in the wasm runtime; there is no
live setter FFI yet, so this is accepted (for MoveableBodyLike
compatibility) but has no effect.
Parameters
_damping
number
Returns
void
setLinvel()
setLinvel(
velocity,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:138
Parameters
velocity
PhysicsVector3
_wakeUp?
boolean = true
Returns
void
setRotation()
setRotation(
rotation,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:133
Parameters
rotation
PhysicsQuaternion
_wakeUp?
boolean = true
Returns
void
setTranslation()
setTranslation(
translation,_wakeUp?):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:128
Parameters
translation
PhysicsVector3
_wakeUp?
boolean = true
Returns
void
translation()
translation():
PhysicsVector3
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:97
Returns
PhysicsVector3
writeRenderPose()
writeRenderPose(
alpha,outPosition,outRotation):void
Defined in: packages/game-lib/src/lib/collision/simulation-body.ts:283
Zero-allocation render-pose read for hot paths (instanced rendering of thousands of bodies). Interpolates the previous → current fixed-step poses straight from the shared render buffer into the provided out-parameters — no intermediate pose objects.
Parameters
alpha
number
outPosition
x
number
y
number
z
number
outRotation
w
number
x
number
y
number
z
number
Returns
void