Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

i want to get rotation vector from matrix to realize some parent-children system for models.


 Matrix bonePos = link.Bone.Transform * World;
 Matrix m = Matrix.CreateTranslation(link.Offset)
       * Matrix.CreateScale(link.gameObj.Scale.X, link.gameObj.Scale.Y, 
                 link.gameObj.Scale.Z)
       * Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(link.gameObj.Rotation.Y),
                 MathHelper.ToRadians(link.gameObj.Rotation.X),
                 MathHelper.ToRadians(link.gameObj.Rotation.Z))
//need rotation vector from bone matrix here (now it's global model rotation vector)
        * Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(Rotation.Y),
                  MathHelper.ToRadians(Rotation.X),
                  MathHelper.ToRadians(Rotation.Z))
         * Matrix.CreateTranslation(bonePos.Translation);
link.gameObj.World = m;

where : link - struct with children model settings, like position, rotation etc.
And link.Bone - Parent Bone

share|improve this question
    
there is a Matrix.Decompose method, if thats what you are looking for –  Kikaimaru Oct 15 '12 at 9:26
    
yeah, thanks a a lot :) –  mr.Smyle Oct 15 '12 at 9:32
add comment

1 Answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.