Rotating objects along local axes
I''m wondering if someone could help me out with the method to rotate objects around their local axes. I have 3 vectors (Up, Right and Direction) which point along the local x,y,z axes for the object and I''m wondering how (given an inital world space rotation) I can transform the amount the object is rotated around each axes into how much its rotated around the world x,y,z axes.
Any help is appreciated.
##UnknownPlayer##
##UnknownPlayer##
transform it with the object matrix. this matrix tranform from local to world.
do you know how transform a vector with a matrix ?
this function return the transformed vector.
D3DVECTOR SetMatrixToVector(D3DMATRIX TransformMat, D3DVECTOR Vec)
{
D3DVECTOR VecTemp;
VecTemp.x=TransformMat._11*Vec.x+TransformMat._21*Vec.y+TransformMat._31*Vec.z+TransformMat._41;
VecTemp.y=TransformMat._12*Vec.x+TransformMat._22*Vec.y+TransformMat._32*Vec.z+TransformMat._42;
VecTemp.z=TransformMat._13*Vec.x+TransformMat._23*Vec.y+TransformMat._33*Vec.z+TransformMat._43;
return VecTemp;
}
[edited by - Fantasio on February 17, 2003 9:13:28 PM]
do you know how transform a vector with a matrix ?
this function return the transformed vector.
D3DVECTOR SetMatrixToVector(D3DMATRIX TransformMat, D3DVECTOR Vec)
{
D3DVECTOR VecTemp;
VecTemp.x=TransformMat._11*Vec.x+TransformMat._21*Vec.y+TransformMat._31*Vec.z+TransformMat._41;
VecTemp.y=TransformMat._12*Vec.x+TransformMat._22*Vec.y+TransformMat._32*Vec.z+TransformMat._42;
VecTemp.z=TransformMat._13*Vec.x+TransformMat._23*Vec.y+TransformMat._33*Vec.z+TransformMat._43;
return VecTemp;
}
[edited by - Fantasio on February 17, 2003 9:13:28 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement