Jump to content
  • Advertisement
Sign in to follow this  
Therion__

Spaceship Movement

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
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 this post


Link to post
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.glLoadIdentity();

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)



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!