View Full Version : Object Rotation Problems

01-27-2002, 10:03 AM
I am trying to create an engine where objects can move around based on the direction they are facing. I use quaternions and matrices to determine rotation angles and the movement vector for the objects but I am still having trouble getting them to move around right. After doing the camera translations with glRotatef and Translatef I then move on to the objects. The code is like this:

All objects start by facing down the negative z direction when rotated 0 degrees. The problem is that glRotatef seems to rotate the objects clockwise instead of counterclockwise so if an object is rotated +90 degrees it ends up 90 degrees to the right of its initial direction. When its given a velocity to move, however, it moves backward as if it were facing the other direction. I have done experiments with moving up and down as well and it seems if the object would rotate in the opposite direction it would match the movement perfectly. How exactly can I get my objects to rotate correctly so the movement corresponds to the actual direction they are facing? Thanks for the help.