Ver código fonte

update physics position using absolutePosition instead of pivotPosition

Trevor Baron 6 anos atrás
pai
commit
30dc362403

+ 3 - 0
src/Physics/Plugins/babylon.ammoJSPlugin.ts

@@ -442,6 +442,9 @@ module BABYLON {
                     // Fill with sphere but collision is disabled on the rigid body in generatePhysicsBody, using an empty shape caused unexpected movement with joints
                     returnValue = new Ammo.btSphereShape(extendSize.x / 2);
                     break;
+                default:
+                    Tools.Warn("The impostor type is not currently supported by the ammo plugin.");
+                    break;
             }
 
             return returnValue;

+ 1 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -638,7 +638,7 @@ module BABYLON {
                 this._tmpQuat.copyFrom(this.object.rotationQuaternion || new Quaternion());
             }
             if (!this._options.disableBidirectionalTransformation) {
-                this.object.rotationQuaternion && this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(this, /*bInfo.boundingBox.centerWorld*/ this.object.getAbsolutePivotPoint(), this._tmpQuat);
+                this.object.rotationQuaternion && this._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(this, /*bInfo.boundingBox.centerWorld*/ this.object.getAbsolutePosition(), this._tmpQuat);
             }
 
             this._onBeforePhysicsStepCallbacks.forEach((func) => {