3d model rotation
ok, i have a 3d model which is going to be my player''s ship. i want to rotate the nose of the ship to point wherever the camera is pointing.. is there anyway to rotate the ship using the cameras x, y, z vectors? i have posted about this before but didnt really get a solid answer... just checking to see if anyone knows now :D
-Mike Tiradohttp://www.vertexdub.net
A way that should work:
-find the cosine angles of the vector.
-Apply those angles to create 3 matricies for rotation about every axis
-Multiply those together
-Use the gl matrix routines to apply the transformation
I think that should work
-find the cosine angles of the vector.
-Apply those angles to create 3 matricies for rotation about every axis
-Multiply those together
-Use the gl matrix routines to apply the transformation
I think that should work

hrmmm .. i dont know how to do any of that, anywhere to read up on it ? *cries*
-Mike Tiradohttp://www.vertexdub.net
June 08, 2002 09:24 AM
http://www.gamedev.net/reference/programming/features/vecmatprimer/
well, the problem could be solved using a antirotation i guess, this means rotating the scene in the opositing way as originally:
if the original rotation is
glRotate(x,1,0,0);
glRotate(y,0,1,0);
glRotate(z,0,0,1);
then call
glPushmatrix();
glRotate(-z,0,0,1);
glRotate(-y,0,1,0);
glRotate(-,1,0,0);
// Translate and Draw...
glPopmatrix();
if the original rotation is
glRotate(x,1,0,0);
glRotate(y,0,1,0);
glRotate(z,0,0,1);
then call
glPushmatrix();
glRotate(-z,0,0,1);
glRotate(-y,0,1,0);
glRotate(-,1,0,0);
// Translate and Draw...
glPopmatrix();
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement