syncPhysics

@three-blocks/pro
syncPhysics(state : Object, mesh : THREE.Object3D, alpha : number)

Sync physics state to a Three.js object with interpolation.

Works for all body types (dynamic, kinematic) that have position/quaternion and their previous frame values (prevPosition*, prevQuaternion*).

Parameters
stateObject
Physics body state (from physics.player, getKinematicBody, etc.)
meshTHREE.Object3D
Target Three.js object to sync position/quaternion to
alphanumber
Interpolation factor (0-1), typically from PhysicsController.getInterpolationAlpha()
Example
const alpha = physicsController.getInterpolationAlpha();

// Dynamic body
syncPhysics(physics.player, playerMesh, alpha);

// Kinematic body
const state = physics.getKinematicBody(index);
syncPhysics(state, platformMesh, alpha);