eisebs
04-11-2003, 06:49 AM
Hello everyone!
I've got _SEVERE_ problems with sheres rolling around on planes.
My first thought was: This must be a piece of cake. But it turned out to be much more complex than I thought (or I'm just too stupid.)
I figured out now that I must somehow store the old angular position and for the next frame rotate it again aroung the new rotation axis.
So I get the rotation matrix with
glGet(GL_MODELVIEW_MATRIX, matrix)
and load it in the next frame with
glLoadMatrix.
But that doesn't help because the new rotation is obviously done around the _local_ axis of the sphere although the matrix that I get with glGet is obviously that from the perspective projection because the translate y-values change while I move around in a plane parallel to the x-y-plane _and_ the Sphere even moves when I move my "camera" so that it stays in the center of the screen.
I think that I got my whole PopMatrix()/PushMatrix()-structure all messed up.
Please help:
How can I rotate an Object around any axis between x and z _IN WORLD COORDINATES_ and "store" its rotation so that afterwards it behaves like it was never rotated and I can rotate it again around any axis between x and z _IN WORLD COORDINATES_ ???
If that looks as confisung to you as it looks to me:
How the hell can I get a Sphere to look like it would roll on a plane when the plane is the x-z-plane and the camera looks down on it?
btw. the pure movement is no problem, that works.
greetz & thanks.
robin
I've got _SEVERE_ problems with sheres rolling around on planes.
My first thought was: This must be a piece of cake. But it turned out to be much more complex than I thought (or I'm just too stupid.)
I figured out now that I must somehow store the old angular position and for the next frame rotate it again aroung the new rotation axis.
So I get the rotation matrix with
glGet(GL_MODELVIEW_MATRIX, matrix)
and load it in the next frame with
glLoadMatrix.
But that doesn't help because the new rotation is obviously done around the _local_ axis of the sphere although the matrix that I get with glGet is obviously that from the perspective projection because the translate y-values change while I move around in a plane parallel to the x-y-plane _and_ the Sphere even moves when I move my "camera" so that it stays in the center of the screen.
I think that I got my whole PopMatrix()/PushMatrix()-structure all messed up.
Please help:
How can I rotate an Object around any axis between x and z _IN WORLD COORDINATES_ and "store" its rotation so that afterwards it behaves like it was never rotated and I can rotate it again around any axis between x and z _IN WORLD COORDINATES_ ???
If that looks as confisung to you as it looks to me:
How the hell can I get a Sphere to look like it would roll on a plane when the plane is the x-z-plane and the camera looks down on it?
btw. the pure movement is no problem, that works.
greetz & thanks.
robin