This project has moved and is read-only. For the latest updates, please go here.

Pin Joint Constructor Bug

Topics: Developer Forum
Feb 26, 2008 at 12:11 AM
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 12:26 PM
Ok, I'll look at it.