This project has moved. For the latest updates, please go here.

Pin Joint Constructor Bug

Topics: Developer Forum
Feb 25, 2008 at 11:11 PM
There's a bug in the PinJoint constructor (the one taking in two bodies and two anchors). The problem is that it does not properly transform the anchors to world space to compute the target distance. The code looks like:

Vector2 difference = (body2.position + anchor2) - (body1.position + anchor1);
targetDistance = difference.Length()

but this only works when the bodies have no rotation. It should be

Vector2 difference = body2.GetWorldPosition(anchor2) - body1.GetWorldPosition(anchor1)

You can currently work around the bug by using the default constructor and setting the values manually, as the property declarations properly take this into account.

Feb 26, 2008 at 11:26 AM
Ok, I'll look at it.