Browse Source

Fixed bug when using updateBodyPosition

Oimo takes a Vec3 (update from Oimo last version). Body is not sleeping when the position is updated.
Temechon 10 năm trước cách đây
mục cha
commit
4553ec59d1
1 tập tin đã thay đổi với 8 bổ sung6 xóa
  1. 8 6
      Babylon/Physics/Plugins/babylon.oimoJSPlugin.ts

+ 8 - 6
Babylon/Physics/Plugins/babylon.oimoJSPlugin.ts

@@ -71,7 +71,7 @@ module BABYLON {
 
                 case PhysicsEngine.PlaneImpostor:
                 //Oimo "fakes" a cylinder as a box, so why don't we!
-                case PhysicsEngine.CylinderImpostor:
+                case PhysicsEngine.CylinderImpostor:u
                 case PhysicsEngine.BoxImpostor:
 
                     var min = bbox.minimumWorld;
@@ -231,8 +231,9 @@ module BABYLON {
                     mesh.computeWorldMatrix(true);
 
                     var center = mesh.getBoundingInfo().boundingBox.center;
-                    body.setPosition(center.x, center.y, center.z);
-                    body.setRotation(mesh.rotation.x, mesh.rotation.y, mesh.rotation.z);
+                    body.setPosition(new OIMO.Vec3(center.x, center.y, center.z));
+                    body.setRotation(new OIMO.Vec3(mesh.rotation.x, mesh.rotation.y, mesh.rotation.z));
+                    body.sleeping = false;
                     return;
                 }
                 // Case where the parent has been updated
@@ -244,8 +245,9 @@ module BABYLON {
                     var absoluteRotation = mesh.rotation;
 
                     body = registeredMesh.body.body;
-                    body.setPosition(absolutePosition.x, absolutePosition.y, absolutePosition.z);
-                    body.setRotation(absoluteRotation.x, absoluteRotation.y, absoluteRotation.z);
+                    body.setPosition(new OIMO.Vec3(absolutePosition.x, absolutePosition.y, absolutePosition.z));
+                    body.setRotation(new OIMO.Vec3(absoluteRotation.x, absoluteRotation.y, absoluteRotation.z));
+                    body.sleeping = false;
                     return;
                 }
             }
@@ -376,4 +378,4 @@ module BABYLON {
             }
         }
     }
-}
+}