How would I create a rotation matrix that rotates X by a, Y by b, and Z by c?
I need to formulas, unless you're using the ardor3d api's functions/methods.
Matrix is set up like this
xx, xy, x开发者_如何学Pythonz,
yx, yy, yz,
zx, zy, zz
A Quaternion is fine too.
See Wikipedia. It gives separate matrices for each axis of rotation. But X*(Y*(Z*v)))
is of course equal to (X*Y*Z)*v
, so you can get a single rotation matrix R as R=X*Y*Z
.
Does this work for you?
glrotate(c, 0, 0, 1); // with respect to Z axis
glrotate(b, 0, 1, 0); // with respect to Y axis
glrotate(a, 1, 0, 0); // with respect to X axis
精彩评论