Question

I am making a 3d bicicle and a track. So far i draw them and animate their movements. However in the begining the whole track + bicicle rotated around the view. Like i am rotating the whole thing. Later i made so that the bicicles can rotate on their axes when changing directions. Whit the help of popmatrix and pushmatrix. Now when i try to rotate the view the track and the drivers dont rotate arrond the center axes but insted arround my camera. I tried to place them at the 0 coordinate rotate and put them back but it does not work at all.

        Gl.glTranslatef(0, 0, -100);

        Gl.glTranslatef(0, 0, 0);
        Gl.glRotatef(rotate, 0, 1, 0);
        Gl.glTranslatef(0, 0, -100);

I am using this before i draw any models. If i do it between only one model will rotate.

Was it helpful?

Solution

This seem to work. Dont know why.

Gl.glTranslatef(0, 0, zoom);
Gl.glRotatef(rotate, 0, 1, 0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top