Quellcode durchsuchen

Cylinder bug fix for cannon

Raanan Weber vor 9 Jahren
Ursprung
Commit
b061924693
1 geänderte Dateien mit 2 neuen und 3 gelöschten Zeilen
  1. 2 3
      src/Physics/Plugins/babylon.cannonJSPlugin.ts

+ 2 - 3
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -260,7 +260,7 @@
                     var min = bbox.minimumWorld;
                     var min = bbox.minimumWorld;
                     var max = bbox.maximumWorld;
                     var max = bbox.maximumWorld;
                     var box = max.subtract(min);
                     var box = max.subtract(min);
-                    returnValue = new CANNON.Cylinder(new CANNON.Vec3(this._checkWithEpsilon(box.x) / 2, this._checkWithEpsilon(box.x) / 2, this._checkWithEpsilon(box.y), 16));
+                    returnValue = new CANNON.Cylinder(this._checkWithEpsilon(box.x) / 2, this._checkWithEpsilon(box.x) / 2, this._checkWithEpsilon(box.y), 16);
                     break;
                     break;
                 case PhysicsImpostor.BoxImpostor:
                 case PhysicsImpostor.BoxImpostor:
                     var min = bbox.minimumWorld;
                     var min = bbox.minimumWorld;
@@ -284,7 +284,6 @@
                 case PhysicsImpostor.ParticleImpostor:
                 case PhysicsImpostor.ParticleImpostor:
                     returnValue = new CANNON.Particle();
                     returnValue = new CANNON.Particle();
                     break;
                     break;
-
             }
             }
 
 
             mesh.rotationQuaternion = oldQuaternion;
             mesh.rotationQuaternion = oldQuaternion;
@@ -371,7 +370,7 @@
             var quaternion = mesh.rotationQuaternion;
             var quaternion = mesh.rotationQuaternion;
             this._tmpPosition.copyFrom(mesh.getBoundingInfo().boundingBox.center);
             this._tmpPosition.copyFrom(mesh.getBoundingInfo().boundingBox.center);
             //is shape is a plane or a heightmap, it must be rotated 90 degs in the X axis.
             //is shape is a plane or a heightmap, it must be rotated 90 degs in the X axis.
-            if (impostor.type === PhysicsEngine.PlaneImpostor || impostor.type === PhysicsEngine.HeightmapImpostor) {
+            if (impostor.type === PhysicsImpostor.PlaneImpostor || impostor.type === PhysicsImpostor.HeightmapImpostor || impostor.type === PhysicsImpostor.CylinderImpostor) {
                 //-90 DEG in X, precalculated
                 //-90 DEG in X, precalculated
                 quaternion = quaternion.multiply(this._minus90X);
                 quaternion = quaternion.multiply(this._minus90X);
                 //Invert! (Precalculated, 90 deg in X)
                 //Invert! (Precalculated, 90 deg in X)