Advertisement

World matrix for 3D animation...

Started by January 12, 2000 02:52 PM
2 comments, last by Crousto 25 years, 1 month ago
Hello, I''m trying to render an animation exported from 3DSMAX (made my own file format with MAXscript). Everything works right if i use only translations, but i can''t make it work right with rotations, especially rotation centers. So if i have the coords of the pivot point, a matrix for the world transformation of the parent mesh, the translation vector and the rotation quaternion for a given mesh at a given frame, how do i compute the new world matrix? I''m currently using a matrix stack, multiplying the top of the stack by the rotation-around-the-pivot and translation matrix, then pushing the new matrix in the stack. But rotation centers never are at the right place... why?
I do believe you need to translate the pivot to the origin first, then apply the rotation, and finally untranslate it back.

If you already knew that, then please forgive me.
Advertisement
I use a function (D3DXMatrixAffineTransformation) which take a parameter for the rotation center (the pivot), so i don''t think the problem is there (thanks anyway!). In fact my rotation center isn''t where it should be only when its object is child of another rotating object.
In that case, it''s possible that the pivot points for the child objects are specified _relative_ to the parent object. So, when creating your affine transform matrix, try specify the pivot vector as parent_vector + child_vector

-genovov

This topic is closed to new replies.

Advertisement