浏览代码

Update babylon.cannonJSPlugin.ts

Under specific terms, this must be used. Otherwise there will be an error in constraints-processing
Raanan Weber 9 年之前
父节点
当前提交
328bada45f
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      src/Physics/Plugins/babylon.cannonJSPlugin.ts

+ 4 - 1
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -191,7 +191,10 @@
             //set the collideConnected flag after the creation, since DistanceJoint ignores it.
             constraint.collideConnected = !!jointData.collision
             impostorJoint.joint.physicsJoint = constraint;
-            this.world.addConstraint(constraint);
+            //don't add spring as constraint, as it is not one.
+            if(impostorJoint.joint.type !== PhysicsJoint.SpringJoint) {
+                this.world.addConstraint(constraint);
+            }
         }
 
         public removeJoint(joint: PhysicsImpostorJoint) {