Pin Joint (bodies get separated by joint)

Topics: Developer Forum, User Forum
Dec 10, 2009 at 3:49 PM

http://i630.photobucket.com/albums/uu29/andycambo/PinJoint.jpg

 

As you can, hopefully, see from the picture in the link, I am trying to connect the bottom rectangle body to the centre of the wheel with a Pin Joint.  The idea of the Pin Joint is to allow the wheel to freely rotate (acting like a wheel).

 

However there is a large Joint gap in between the two bodies.  What I actually want is the wheel to be placed on top of the rectangle body at the end (where the Pin Joint connects).  I don’t understand why there is a line connecting the bodies.  The positions (when not using a Pin joint) are exactly how I want them, the wheel on top of the rectangle body, but when I go to add the Pin Joint I get this problem.

 

Why is the joint like this?  Why does it separate the bodies when using the joint?

 

Any help is appreciated.

 

Here is my code

 

Pin Join Code:

PinJoint PinJoint1 = new PinJoint(_rectangleBody, new Vector2(_rectangleBodyLength / 2 ,0), _fWheelBody, new Vector2(0, 0));

 

Position Code:

_rectangleBody.Position = new Vector2(_position.X + _rectangleBodyLength / 2, _position.Y + 25);

 

_fWheelBody.Position = new Vector2(_position.X  + _rectangleBodyLength, (_position.Y + _rectangleBodyHeight + 25));

 

Thanks,

Andy.

Dec 20, 2009 at 2:40 PM

I still haven't found a solution to this problem.

 

Any help is appreciated!