Parcourir la source

Update babylon.cannonJSPlugin.ts

Under specific terms, this must be used. Otherwise there will be an error in constraints-processing
Raanan Weber il y a 9 ans
Parent
commit
328bada45f
1 fichiers modifiés avec 4 ajouts et 1 suppressions
  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) {