Fix bug with dice throw not working on windows once a dice had come to rest

This commit is contained in:
Mitchell McCaffrey 2020-08-07 20:56:21 +10:00
parent 9e6476c338
commit 2bf89eb273

View File

@ -53,7 +53,9 @@ function DiceInteraction({ onSceneMount, onPointerDown, onPointerUp }) {
);
const currentPosition = selectedMesh.getAbsolutePosition();
let newPosition = ray.origin.scale(camera.globalPosition.y);
newPosition.y = currentPosition.y;
// Manually set the y value, using currentPosition.y caused a bug with windows
// where the physics wasn't updated
newPosition.y = 1.5;
const delta = newPosition.subtract(currentPosition);
selectedMesh.setAbsolutePosition(newPosition);
const velocity = delta.scale(1000 / scene.deltaTime);