cannon.js: Lock constraint always aligns rotation of the 2 bodies?

Has anyone else ever had this problem? I’ve been trying to nut it out all day. lock constraint I initialise the two boxes like the picture on the left, but when I apply the LockConstraint, both boxes quickly rotate around so that they are aligned (but offset) like the picture on the right, and then lock into place like that.

My code for applying the constraint is simply:

      var c = new CANNON.LockConstraint(bodyA, bodyB, {
         maxForce: params.maxForce || Number.MAX_VALUE
      });
      c.collideConnected = false;
      this.world.addConstraint(c);

I haven’t fully tested other constraint types for similar behavior, but preliminary tests show similar behavior - if the bodies have different orientations, they will be aligned when I add the constraint.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (5 by maintainers)

Most upvoted comments

Physics for A-Frame VR currently uses https://github.com/donmccurdy/cannon.js/tree/v0.6.2-dev1, to include this fix.

Hello, we have this issue with the latest version we found on the repo. Is this fix available somewhere? Do you think you could build a new release?