Upper and Lower limits for joints

Topics: Developer Forum, User Forum
Jul 11, 2013 at 12:59 PM
Edited Jul 11, 2013 at 1:00 PM
Hi, whenever I set upper and lower limits of a joint (rotational in this case), things get really weird, I have to negate the angles I expected to set.

For example, when I want to lock the rotation of a joint at its current angle, I have to set it like this;
    public void Lock()
    {
        _fixedRevoluteJoint.LowerLimit = -_fixedRevoluteJoint.JointAngle;
        _fixedRevoluteJoint.UpperLimit = -_fixedRevoluteJoint.JointAngle;
        IsLocked = true;
    }
Which is extremely counter-intuitive. I mean, LowerLimit = -JointAngle? And that actually works.

Anyone know why this is?

/mattias
Coordinator
Jul 16, 2013 at 2:46 AM
Without knowing for sure, it might be a bug introduced in the conversion from non-fixed to a fixed version of the joint. I've experienced some weird behavior with the fixed joints, and it went away when I reverted to a non-fixed version. That is also why I have removed the fixed versions for now, and will consult Erin Catto (author of Box2d) on the subject.