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

Best way to fix two bodies together?

May 6, 2009 at 8:17 PM
I'm trying to use a joint to fix a circular body to the corner of a rectangular body, but no matter which kind of joint I try, I can't get the two to move together without any elasticity.  Its driving me mad.

The rectangular body is intended to be a player character, and the circular body is intended to be their outstretched hand.  I've managed to set things up so the hand doesn't alter the movement of the player at all, and doesn't collide with anything, but it still bounces and swings when the player jumps.  I've tried a fixedAngle joint, a Pin joint, even a Slider Joint with the minimum and maximum set to 0.  No matter what, the "hand" bounces and waves around when I move the player up, even though they're not colliding.

May 6, 2009 at 8:56 PM
Is it supposed to say fixed no matter what?

If that is the case, just create two geometries with the same body. You can offset the hand geometry so that it say fixed, but moves relative to the torso.
May 7, 2009 at 7:08 AM
If you do actually want them to be able to be broken apart, but stay fixed relative to eachother until then, you will need two joints. A RevoluteJoint will hold the position and a FixedAngleJoint will hold the angle. Also, if you're using something like "Body.Position = newPos", You should probably also set the position of the other body too, ie "OtherBody.Position = newPos + relativePos". In fact, I'd recommend applying forces or impulses to the body(s) as opposed to setting their positions directly.
May 7, 2009 at 8:54 AM
I am having that exact same issue for a different use.  I will have to look at my code, but I think I may need these attached geoms to also have bodies.  If not, thanks genbox.  Unfortunately I haven't had time to play with my code much this week, but I'll let you know.  Also thanks roonda, that sound interesting, I might try that as well.

TheAlanJackExp, did you try this, and if so, did it work for your needs?