From b814a433ebe356329b6f2021d290c7579dd4089d Mon Sep 17 00:00:00 2001 From: Maxim Velesyuk Date: Sun, 3 Nov 2024 19:50:28 +0100 Subject: [PATCH 1/3] Change position of side borders to not allow dice go outside --- src/components/physics.worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/physics.worker.js b/src/components/physics.worker.js index e4e9dd1..0a2e4aa 100644 --- a/src/components/physics.worker.js +++ b/src/components/physics.worker.js @@ -399,7 +399,7 @@ const addBoxToWorld = (size, height) => { const wallRightTransform = new Ammo.btTransform() wallRightTransform.setIdentity() - wallRightTransform.setOrigin(setVector3((size * aspect / -2) - .5, 0, 0)) + wallRightTransform.setOrigin(setVector3((size * aspect / -2) + .5, 0, 0)) const wallRightShape = new Ammo.btBoxShape(setVector3(1, height, size)) const rightMotionState = new Ammo.btDefaultMotionState(wallRightTransform) const rightInfo = new Ammo.btRigidBodyConstructionInfo(0, rightMotionState, wallRightShape, localInertia) @@ -412,7 +412,7 @@ const addBoxToWorld = (size, height) => { const wallLeftTransform = new Ammo.btTransform() wallLeftTransform.setIdentity() - wallLeftTransform.setOrigin(setVector3((size * aspect / 2) + .5, 0, 0)) + wallLeftTransform.setOrigin(setVector3((size * aspect / 2) - .5, 0, 0)) const wallLeftShape = new Ammo.btBoxShape(setVector3(1, height, size)) const leftMotionState = new Ammo.btDefaultMotionState(wallLeftTransform) const leftInfo = new Ammo.btRigidBodyConstructionInfo(0, leftMotionState, wallLeftShape, localInertia) From c30f25530d926d19a4e791fff305cd5880ed60fc Mon Sep 17 00:00:00 2001 From: Maxim Velesyuk Date: Sun, 3 Nov 2024 20:10:30 +0100 Subject: [PATCH 2/3] Improve position offset --- src/components/physics.worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/physics.worker.js b/src/components/physics.worker.js index 0a2e4aa..c611586 100644 --- a/src/components/physics.worker.js +++ b/src/components/physics.worker.js @@ -399,7 +399,7 @@ const addBoxToWorld = (size, height) => { const wallRightTransform = new Ammo.btTransform() wallRightTransform.setIdentity() - wallRightTransform.setOrigin(setVector3((size * aspect / -2) + .5, 0, 0)) + wallRightTransform.setOrigin(setVector3((size * aspect / -2), 0, 0)) const wallRightShape = new Ammo.btBoxShape(setVector3(1, height, size)) const rightMotionState = new Ammo.btDefaultMotionState(wallRightTransform) const rightInfo = new Ammo.btRigidBodyConstructionInfo(0, rightMotionState, wallRightShape, localInertia) @@ -412,7 +412,7 @@ const addBoxToWorld = (size, height) => { const wallLeftTransform = new Ammo.btTransform() wallLeftTransform.setIdentity() - wallLeftTransform.setOrigin(setVector3((size * aspect / 2) - .5, 0, 0)) + wallLeftTransform.setOrigin(setVector3((size * aspect / 2), 0, 0)) const wallLeftShape = new Ammo.btBoxShape(setVector3(1, height, size)) const leftMotionState = new Ammo.btDefaultMotionState(wallLeftTransform) const leftInfo = new Ammo.btRigidBodyConstructionInfo(0, leftMotionState, wallLeftShape, localInertia) From f61ff73d60ba322e5e57c1f447f6fed4e415e4a0 Mon Sep 17 00:00:00 2001 From: Maxim Velesyuk Date: Sun, 3 Nov 2024 20:19:49 +0100 Subject: [PATCH 3/3] Make side walls thicker --- src/components/physics.worker.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/physics.worker.js b/src/components/physics.worker.js index c611586..68c0732 100644 --- a/src/components/physics.worker.js +++ b/src/components/physics.worker.js @@ -400,7 +400,7 @@ const addBoxToWorld = (size, height) => { const wallRightTransform = new Ammo.btTransform() wallRightTransform.setIdentity() wallRightTransform.setOrigin(setVector3((size * aspect / -2), 0, 0)) - const wallRightShape = new Ammo.btBoxShape(setVector3(1, height, size)) + const wallRightShape = new Ammo.btBoxShape(setVector3(1.5, height, size)) const rightMotionState = new Ammo.btDefaultMotionState(wallRightTransform) const rightInfo = new Ammo.btRigidBodyConstructionInfo(0, rightMotionState, wallRightShape, localInertia) const rightBody = new Ammo.btRigidBody(rightInfo) @@ -413,7 +413,7 @@ const addBoxToWorld = (size, height) => { const wallLeftTransform = new Ammo.btTransform() wallLeftTransform.setIdentity() wallLeftTransform.setOrigin(setVector3((size * aspect / 2), 0, 0)) - const wallLeftShape = new Ammo.btBoxShape(setVector3(1, height, size)) + const wallLeftShape = new Ammo.btBoxShape(setVector3(1.5, height, size)) const leftMotionState = new Ammo.btDefaultMotionState(wallLeftTransform) const leftInfo = new Ammo.btRigidBodyConstructionInfo(0, leftMotionState, wallLeftShape, localInertia) const leftBody = new Ammo.btRigidBody(leftInfo)