# 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.

## 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 on other sites
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.

##### 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 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.

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

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633722
• Total Posts
3013547
×