Archived

This topic is now archived and is closed to further replies.

kimryo

Doing rotating per-vertex?

Recommended Posts

kimryo    100
I have a rotation matrix,it gives right rotate result when multiply(second param in D3DXMatrixMultiply) to world matrix;but I need apply this matrix to every vertex,I use follow codes: v.x = v.x*m_matRotate._11 + v.y*m_matRotate._21 + v.z*m_matRotate._31 + m_matRotate._41; v.y = v.x*m_matRotate._12 + v.y*m_matRotate._22 + v.z*m_matRotate._32 + m_matRotate._42; v.z = v.x*m_matRotate._13 + v.y*m_matRotate._23 + v.z*m_matRotate._33 + m_matRotate._43; but got wrong result...why? We create world.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
Because when you''re calculating v.y, v.x is already overwritten by the new value. When doing v.z, both v.x and v.y are already overwritten.

Use a temporary vector for source or result, and you should be okay.

Share this post


Link to post
Share on other sites
kimryo    100
Well...Sorry for post a sooooo stupid question....I think I should have a rest now...Its already 2003/5/1 0:23...

We create world.

Share this post


Link to post
Share on other sites