Added reset to dice physics when rerolling
This commit is contained in:
parent
70f68a9093
commit
3be729d4a0
@ -65,10 +65,10 @@ function DiceScene({ onSceneMount, onPointerDown, onPointerUp }) {
|
||||
const pickInfo = scene.pick(scene.pointerX, scene.pointerY);
|
||||
if (pickInfo.hit && pickInfo.pickedMesh.id !== "tray") {
|
||||
pickInfo.pickedMesh.physicsImpostor.setLinearVelocity(
|
||||
new BABYLON.Vector3(0, 0, 0)
|
||||
BABYLON.Vector3.Zero()
|
||||
);
|
||||
pickInfo.pickedMesh.physicsImpostor.setAngularVelocity(
|
||||
new BABYLON.Vector3(0, 0, 0)
|
||||
BABYLON.Vector3.Zero()
|
||||
);
|
||||
selectedMeshRef.current = pickInfo.pickedMesh;
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ class Dice {
|
||||
}
|
||||
|
||||
static roll(instance) {
|
||||
instance.physicsImpostor.setLinearVelocity(BABYLON.Vector3.Zero());
|
||||
instance.physicsImpostor.setAngularVelocity(BABYLON.Vector3.Zero());
|
||||
|
||||
const trayOffsetHeight = diceTraySize.height / 2 - 0.5;
|
||||
const position = new BABYLON.Vector3(
|
||||
((Math.random() * 2 - 1) * diceTraySize.width) / 2,
|
||||
|
Loading…
Reference in New Issue
Block a user