Jump to content
  • Advertisement
Sign in to follow this  
_WeirdCat_

Calculating new angles for aircraft rotation?

This topic is 2707 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

LOL i just want to make model fly, but i cant calculate properly 2 angles :<

i have defined 3 angles roll pitch and yaw

http://upload.wikimedia.org/wikipedia/commons/7/7e/Rollpitchyawplain.png

imopi = pi / 180.0f

(please note that i use) opengl for rendering

glRotatef(PHYSIC_MODEL->yaw_angle,0.0,1.0,0.0); // YAW
glRotatef(PHYSIC_MODEL->pitch_angle,1.0,0.0,0.0); // PITCH
glRotatef(PHYSIC_MODEL->roll_angle,0.0,0.0,1.0); // ROLL
[/quote]

so when i want to go 'up' with my aircraft i use this formula

pitch_angle = pitch_angle + sin((roll_angle+90.0f)*imopi)*3.0f;

yaw_angle = yaw_angle - cos((roll_angle+90.0f)*imopi)*3.0f;



and i end with this:

[media]
[/media]




As you can see when roll angle is -360, -270, -180, -90, 0, 90, 180, 270, 360, everything rotates correctly but when its not i got this:

[media]
[/media]

it shouldn't spin like that

well i realize that when yaw angle is between -180 and 180 or pitch angle is between -90 and 90 this formula is true:

pitch_angle = pitch_angle + sin((roll_angle+90.0f)*imopi)*3.0f; yaw_angle = yaw_angle - cos((roll_angle+90.0f)*imopi)*3.0f;

otherwise everything rotates in opposite direction etc. but it is a problem with sign i can make a function like if sin(angle) < 0 then bleble ble else ble




but i cant imagine further calculations :C can anyone help me, if understand this post :F

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!