Spaceship Movement

This topic is 3840 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Hello, i got an mathematical problem with my game project. i work on an spaceship game and its abbout the rotation/angle thing. i got: view_r1= Yaw view_r2= Pitch view_r3= Roll i rotate the ship (view_r3) and when i pull back the stick the view_r1 and view_r2 should change the angle in the direction view_r3 is showing... annormal thing also on airplane simulations..but i cant get this to work //this code is not working/complete Wrong ... float ee1=(float) ((mouse_yy*0.2)*Math.sin(view_r3*3.141593/180)); float ee2=(float) ((mouse_yy*0.2)*Math.cos(view_r3*3.141593/180)); view_r1+=ee1; view_r2+=ee2; `... can somebody help me?

Share on other sites
This seems to be right, though I warn you, you may not get the exact simulation you're looking for, i.e. the ship won't rotate a full 360 dg. about the axis (you'll see, I guess).

However, looking at the code, don't you think there should be sqrt(sqr(mouse_xx)+sqr(mouse_yy)) there instead of just mouse_yy? Maybe that's the problem.

Share on other sites
I suppose to drop the usage of angles, and to use the orientation basis instead. Then change the basis by incremental rotations determined from the movement or deviation of the mouse.

Share on other sites
thx for the reply

the mouse_yy was only a simple test

here what i use for the view

gl.glMatrixMode(GL.GL_MODELVIEW);

gl.glTranslatef(0.0f,0.0f,0.0f);
gl.glRotatef(-vr3, 0, 0, 1);
gl.glRotatef(-vr2, 1, 0, 0);
gl.glRotatef(-vr1, 0, 1, 0);

its hard to describe what i think what the solution can
be.(my english is not the best)

using a point with coordinates 0,1,10 (a little bit over the y)
then doing the rotation calculation.
after all the point must be in the place where the new
orientation must be..then only calculating the angles

but i didnt know how to do this

first problem:
gl.glRotatef(-vr3, 0, 0, 1);
gl.glRotatef(-vr2, 1, 0, 0);
gl.glRotatef(-vr1, 0, 1, 0);
how they are calculated (the formula)

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 12
• 26
• 10
• 11
• 9
• Forum Statistics

• Total Topics
633723
• Total Posts
3013545
×