EntityProxy
new EntityProxy(sharedView : Array<BufferBackedObject>, index : number, controller : PhysicsController)EntityProxy - Physics Body State Accessor
Provides a convenient interface to read physics body state from the SharedArrayBuffer with cached Three.js objects and interpolation support. Use this for rendering physics-driven entities at smooth frame rates.
Features
- Cached THREE.Vector3/Quaternion objects (no allocation per frame)
- Interpolation between physics steps for smooth rendering
- State flags for game logic (grounded, jumping, moving)
- Velocity access for animation blending
Properties Overview
| Property | Type | Description |
|---|---|---|
| position | Vector3 | Interpolated world position |
| quaternion | Quaternion | Interpolated world rotation |
| velocity | Vector3 | External velocity (world space) |
| localVelocity | Vector3 | Local velocity (body space) |
| active | boolean | Whether this slot is in use |
| grounded | boolean | Whether touching ground |
| jumping | boolean | Currently in jump |
| moving | boolean | Has movement input |
| sleeping | boolean | Physics sleeping (get/set) |
| mass | number | Body mass (get/set) |
| friction | number | Body friction (get/set) |
Constructor Parameters
sharedViewArray<BufferBackedObject>Array of buffer-backed body objects
indexnumberIndex of this body in the array
controllerPhysicsControllerParent controller reference
Example
const player = controller.getDynamic( 0 );
// Apply to mesh with interpolation
player.interpolate( alpha );
mesh.position.copy( player.position );
mesh.quaternion.copy( player.quaternion );
// Or use the convenience method
player.applyTo( mesh, alpha );
// Check state for animations
if ( player.grounded && player.moving ) {
playWalkAnimation();
}
// Read velocity for animation speed
const speed = player.localVelocity.length();
mixer.setEffectiveTimeScale( speed / maxSpeed );