Explorar o código

Update babylon.cannonJSPlugin.ts

Under specific terms, this must be used. Otherwise there will be an error in constraints-processing
Raanan Weber %!s(int64=9) %!d(string=hai) anos
pai
achega
328bada45f
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  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) {