how can i get rotation vector from matrix4x4 in xna?
Posted
by
mr.Smyle
on Game Development
See other posts from Game Development
or by mr.Smyle
Published on 2012-10-15T09:03:21Z
Indexed on
2012/10/15
9:50 UTC
Read the original article
Hit count: 283
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
© Game Development or respective owner