Jump to content
  • Advertisement
Sign in to follow this  
R3DLIN3

Calculating rotation relative to a plane/ground

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

Hey everyone, Alright so here is the question I have a plane that is acting as the ground and I also have an airplane now what I need to do is know the rotation of the airplane relative to the ground so that if the plane is upside down and hits the plane it will crash and so on. The way that I am rotating the airplane is with a quaternion and the airplane can rotate around every axis. Just to let you know I am using xna. oh yeah i have tried just keeping the rotations of the quaternion saved to calculate this but that doesn't work because I allow the player to rotate the airplane on every axis. thanks in advance, Doug

Share this post


Link to post
Share on other sites
Advertisement
This is the exact situations where three-dimensional rotation spanning-sets manifest their true evilness. Assuming that the quaternion is being used to represent the aircraft's orientation about its local origin, then the quaternion coefficients do not uniquely define the situation and all hell breaks loose.

I suggest that you convert, for this calculation only, to a two-dimensional representation such as spherical polar coordinates. This way, your two coordinates may be thrown directly into a bounds-check for the result. Euler angles will not do, as they suffer the same problem as quaternions.

Admiral

Share this post


Link to post
Share on other sites
Thanks for the quick response and the useful information. I was wondering if you know of any good resources where I can read up and learn how to implement a spherical polar coordinates system.

Share this post


Link to post
Share on other sites
Martin Baker admins a great physics site.

http://www.euclideanspace.com/

As for your question directly, It's quite simple. Convert your orientation quaternion into a matrix, take the middle row or column (the 'up' direction), and dot product with the plane normal to see if plane is aligned to the ground. dot product negative, plane upside down. dot product < 0.5, plane is at more that 60 degree angle from the ground (crash).

If you have the orientation of the plane already, then it's 1/2 the job done already.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!