Rolling

I have been have some problems using glRotate for rolling a ball. I rotate the axes by how far the ball has moved in each direction. However, if you rotate the first axis 180 degrees, then you would have to rotate the 2nd axis the opposite way to get the same effect as when the first axis is at 0 degrees. So basically, when the first axis gets rotated about 180 degrees, the 2nd one will reverse on me, so it doesn’t create a consistant rolling. Any way to fix this?

Hi !

You will have to calculate the transformation matrix yourself using quaternions or some other method to do the rotations.

http://skal.planet-d.net/demo/matrixfaq.htm

You can of course also supply a vector to glRotate that is not X,Y or Z aligned, but if you need to calculate that you might do the entire matrix transformation yourself.

Mikael