Enable fixed physics update to prevent issues with low frame rates
This commit is contained in:
parent
a8b61f0223
commit
629a4ad7eb
@ -40,7 +40,10 @@ function DiceInteraction({ onSceneMount, onPointerDown, onPointerUp }) {
|
||||
const scene = new Scene(engine);
|
||||
scene.clearColor = new Color4(0, 0, 0, 0);
|
||||
// Enable physics
|
||||
scene.enablePhysics(new Vector3(0, -98, 0), new AmmoJSPlugin(true, AMMO));
|
||||
scene.enablePhysics(
|
||||
new Vector3(0, -98, 0),
|
||||
new AmmoJSPlugin(false, AMMO)
|
||||
);
|
||||
|
||||
let camera = new TargetCamera("camera", new Vector3(0, 33.5, 0), scene);
|
||||
camera.fov = 0.65;
|
||||
@ -67,7 +70,8 @@ function DiceInteraction({ onSceneMount, onPointerDown, onPointerUp }) {
|
||||
const delta = newPosition.subtract(currentPosition);
|
||||
selectedMesh.setAbsolutePosition(newPosition);
|
||||
const velocity = delta.scale(1000 / scene.deltaTime);
|
||||
selectedMeshVelocityWindowRef.current = selectedMeshVelocityWindowRef.current.slice(
|
||||
selectedMeshVelocityWindowRef.current =
|
||||
selectedMeshVelocityWindowRef.current.slice(
|
||||
Math.max(
|
||||
selectedMeshVelocityWindowRef.current.length -
|
||||
selectedMeshVelocityWindowSize,
|
||||
|
Loading…
Reference in New Issue
Block a user