Hi there,
i got a tricky one…
How do i rotate an object around its 3 axis WITH a mouse?
What i did is:
I got a mouselistener running and convert the incoming integer values for x and y of the mouse into float values.
Then i scaled that values down by multiplying them with 0.01 to get values i can use with glRotatef.
(mrot+n are my float values , while mov+n are my integers i got from my mouse.
mrotx = (movx * 0.01f);
mroty = (movy * 0.01f);
mrotz = (movx/2)+ (movy/2);
Therefore a mouse got no 3rd axis, i helped myself by creating an float mrotz from the x and y values.
I know, dirty.
Then i rotate the whole scene by passing the values through:
gl.glRotatef(mrotz, mrotx, 0f, 0f);
gl.glRotatef(mrotz, 0f, mroty, 0f);
gl.glRotatef(mrotx, 0f, 0f, mrotz);
So, when i move the mouse, i got an rotation like an drunken elk. ;D
It actually rotates around 3 axis, but lously;-)) :persecutioncomplex:
Does anyone of you got an code snippet for an cool and realistic rotation around the z Axis or how could i simulate this with my two x and y values from the mouse?
I actually want to rotate an whole scen of an rotating planet with moving cloudsphere, incl. an sourounding moon. The scene itself runs smoothly by the way, no probs there.
Thanks very much,
elnormeo