rotating two bodies connected with joints

Sep 24, 2008 at 4:03 AM
I've been muddling over this for a while, and I'm trying to decide what's the best way to rotate something like a ragdoll in the air.

If I just rotate the torso, it will screw up the whole body. If I rotate the torso by small increments, the rest of the body will weigh down the rotation and it won't happen.

Ideally, I would rotate the body uniformly while disabled, as in each body disabled from the physicsSimulator. If I rotate each component of the ragdoll, then of course it would just rotate them in place and not around the torso.

Applying enough force to the head will screw up the joint, so creating a rotation by putting a force on the head is not going to work.

Right now, the decision is closest to just basically screen shotting the ragdoll as a Texture, rotating the Texture as a whole, meanwhile resetting the ragdoll to its original constructor position, and once the texture lines up with the reset body in rotation, to go back to using the body rather than just one texture.
The problem of course with that is that we're not rotating the ragdoll to a custom position, but rather just resetting it.

Any thoughts?
Sep 24, 2008 at 5:02 AM
Try rotating every single body from ragdoll around the same center.
Sep 24, 2008 at 3:25 PM
@garus$0$0$0$0that sounds good, but I can't figure out how to do that. =/$0$0$0$0
Sep 24, 2008 at 6:46 PM
Edited Sep 24, 2008 at 6:50 PM
I used this:

        Vector2 Rotate(Vector2 point,Vector2 center, float radians)
        {
            Matrix rotationMatrix = Matrix.CreateRotationZ(radians);
            Vector2 rotatedPoint = Vector2.Transform(point - center, rotationMatrix);
            return rotatedPoint + center;
          
        }

It returns point rotated around specific center, rotate every position of bodies using same center.
Sep 25, 2008 at 4:09 AM
Thanks garus.$0With some tweaking, I think I can get that code to work for my purposes. =)$0