浏览代码

composite rotation working

Trevor Baron 6 年之前
父节点
当前提交
3fd0cdf092
共有 2 个文件被更改,包括 2 次插入4 次删除
  1. 1 3
      src/Physics/Plugins/babylon.ammoJSPlugin.ts
  2. 1 1
      src/Physics/babylon.physicsImpostor.ts

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

@@ -206,7 +206,6 @@ module BABYLON {
             
             if(!ignoreChildren){
                 var meshChildren = impostor.object.getChildMeshes ? impostor.object.getChildMeshes(true) : [];
-                let currentRotation: Nullable<Quaternion> = impostor.object.rotationQuaternion;
                 if (meshChildren.length > 0) {
                     returnValue = new Ammo.btCompoundShape();
                     
@@ -216,10 +215,9 @@ module BABYLON {
                         if(childImpostor){
                             var shape = this._createShape(childImpostor);
                             this._tmpAmmoTransform.getOrigin().setValue(childMesh.position.x, childMesh.position.y,childMesh.position.z);
-                            this._tmpAmmoQuaternion.setValue(currentRotation!.x,currentRotation!.y,currentRotation!.z,currentRotation!.w)
+                            this._tmpAmmoQuaternion.setValue(childMesh.rotationQuaternion!.x,childMesh.rotationQuaternion!.y,childMesh.rotationQuaternion!.z,childMesh.rotationQuaternion!.w)
                             this._tmpAmmoTransform.setRotation(this._tmpAmmoQuaternion)
                             returnValue.addChildShape(this._tmpAmmoTransform, shape);
-                            
                             childImpostor.dispose();
                         }
                     })

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

@@ -411,7 +411,7 @@ module BABYLON {
                 this.object.rotationQuaternion = q;
                 //calculate the world matrix with the new rotation
                 this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);
-
+                console.log(size)
                 return size;
             } else {
                 return PhysicsImpostor.DEFAULT_OBJECT_SIZE;