# How to orient an aircraft with earth

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

## Recommended Posts

Hi all, I have a 3d aircraft which I want to move along a sphere surface (earth). My problem is how to align/orient (which is the right word?) the aircraft according to the sphere surface. I have rotated the aircraft to point to the direction (horizontal direction) it moves, then I translate it to its position. But the orientation of the aircraft doesn't conform with the earth spherical surface. I know the aircraft should be rotated further before being translated to its position. How the rotation is performed to orient the aircraft according to the sphere surface? Thanks very much.

##### Share on other sites
I can't really understand what you're asking, but it sounds like you might trying to get the plane so it flies parallel to the ground? Notice that the vector from the center of the sphere to your airplane is normal to the surface of the sphere, no matter where your plane is. That normal should be the direction that the top of your plane faces (imagine the bounding box around your plane model - you want to align the top face's normal with the normal you found).

##### Share on other sites
Yes, that's what I mean. I want to make my aircraft flies parallel to the ground.
So how to align my aircraft normal with the normal of the sphere surface? What kind of rotation should I make?

##### Share on other sites
If your planet has radius R and its center is at (0,0,0), then if the plane is located at location (x,y,z), the "up" normal at that location will be (x,y,z)/sqrt(x2+y2+z2).

##### Share on other sites
Yes, I know how to calculate the surface normal.
My question is: how to rotate my aircraft so that my aircraft up vector is aligned with that normal?
Suppose the surface normal is (x, y, z), and the aircraft's up vector is (0, 1, 0), how to rotate the aircraft so that its up vector becomes (x, y, z)?

##### Share on other sites
The axis of rotation is the cross product of the current up vector and the desired up vector. The angle, is the angle between the two vectors.

##### Share on other sites
I see. Hmmm... why didn't I think about that before?

Thanks a lot Sneftel.

##### Share on other sites
Just a quick comment, the surface normal = the vector from the center of the earth to the plane, so you don't need to calculate it at all

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 12
• 16
• 26
• 10
• 44
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013744
×