Translate along local axis

Posted by Aaron on Game Development See other posts from Game Development or by Aaron
Published on 2012-07-05T16:21:40Z Indexed on 2012/07/05 21:25 UTC
Read the original article Hit count: 244

Filed under:
|
|

I have an object with a position matrix and a rotation matrix (derived from a quaternion, but I digress). I'm able to translate this object along world-relative vectors, but I'm trying to figure out how to translate it along local-relative vectors. So if the object is tilted 45 degrees around its Z-axis the vector (1, 0, 0) would make it move to the upper right.

For world-space translations I simply turn the movement vector into a matrix and multiply it by the position matrix: position_mat = translation_mat * position_mat. For local-space translations I'd think I'd have to use the rotation matrix into that formula, but I see the object spin around instead when I apply a translation over time no matter where I multiply the rotation matrix.

© Game Development or respective owner

Related posts about 3d

Related posts about matrix