I hope you can help me out with this. I'm attempting to manipulate the position and orientation of a human skeleton in a 3D environment. The skeleton is made up of multiple meshes (skull, body core, left arm, right arm).
The skull and body have the same center of rotation, but the arms have a center of rotation located at the top of each arm. (This is because I need to manipulate the arms separately from the body, later on).
My problem is, I can't seem to figure out the correct transformation to keep the arms with the body. My current code looks as follows (using SlimDX):
//Body
_device.SetTransform(TransformState.World, Matrix.Scaling(_scale, _scale, _scale)
* Matrix.RotationY(_skullYPR.Y) //Rotation about the Y axis
* Matrix.Translation(_position)); //Location in 3D space
...
...
//Right Upper Arm
_device.SetTransform(TransformState.World, Matrix.Scaling(_scale, _scale, _scale)
* Matrix.RotationY(_skullYPR.Y)
* Matrix.Translation(_position.X - 5.0f, _position.Y - 5.5f, _position.Z)); //Offset of arm position
This results in the arm remaining in the same position (with a proper rotation around it's own center of rotation) I've attach a couple images for you to reference.
I've tried adding additional rotation matrices, but I'm just having a brain fart right now and can't think it through properly.
The question is how do I properly apply a rotation that takes into account the translation from the center of the body?
Facing Forward, everything is ok. (I know a collar bone is missing )
[attachment=2199:facing forward.png]
Rotated, rotates in position, doesn't move with body
[attachment=2200:rotated.png]
Any help or direction would be greatly appreciated!!!