Can't get WeldJoint to do much of anything

Topics: User Forum
Oct 16, 2011 at 10:12 PM

I'm trying to get a character to hold an object over his head and keep it there using a weldjoint. So far I'm just playing around with the weldjoint to see if it is in fact what I want. The problem is, I can't seem to get the weldjoint to do much of anything. When it gets created, I can tell something happens because the character no longer collides with the object, but it is not attached to him in any way. I'm just invoking it with

JointFactory.CreateWeldJoint(world, characterBody, objectBody, Vector2.Zero, Vector2.Zero)

The Vector2.Zeros are just placeholders to try and get some sort of working joint going. This invocation looks generally like those of other people who use WeldJoints, but I can't really get any results out of it. Any tips?

Nov 22, 2011 at 7:32 PM

I just got my first joints working... including a weld joint, so I'm no expert.  But try:

JointFactory.CreateWeldJoint(world,characterBody,objectBody,Vector2.Zero,characterBody.Position - objectBody.Position);