Page 1 of 1

b2PrismaticJoint body reach upperLimit

Posted: Tue Oct 01, 2013 11:06 am
by kotaiba
Hi,
How can i get if Body reach the UpperLimit in prismatic joint ?
im using prismatic joint as button so if the prismatic joint reach the Upper limit that mean the button is not pressing , so im i doing it right or there is alternative way .

Re: b2PrismaticJoint body reach upperLimit

Posted: Tue Oct 01, 2013 4:47 pm
by iforce2d
You can use GetJointTranslation, as mentioned at the end of the section about limits here: http://www.iforce2d.net/b2dtut/joints-prismatic
  • Checking if a joint is currently at one of its limits is pretty simple:
    bool atLowerLimit = joint->GetJointTranslation() <= joint->GetLowerLimit();
    bool atUpperLimit = joint->GetJointTranslation() >= joint->GetUpperLimit();

Re: b2PrismaticJoint body reach upperLimit

Posted: Tue Oct 01, 2013 7:02 pm
by kotaiba
thank you ..