Skip to content

Lock constraint always aligns rotation of the 2 bodies? #225

@josephrocca

Description

@josephrocca

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions