# comp.graphics.algorithms

## Subject: Re: Newbie 3D airplane help

"PPP" wrote in message
> Good morning!
>
> I have an idea for a basic 3D game. I'm trying to come up with a
> generic algorithm that will give me a relative x,y,z orientation of a
> plane in reference to the observers on the ground. Let's say I already
> have given the plane a yaw, pitch, roll, and heading values. How can I
> determine the plane's relative orientation to different observers in
> the ground?
>
> What I have in mind is that the relative orientation of the plane can
> be assigned a unique id. If an observer takes a "picture" of this
> unique id / orientation, then a point is scored. Consecutive pictures
> of the orientation will not be counted.
>
> In other words, I have a plane flying around and different observers on
> the ground are looking at it and their object is to "shoot" as much of
> the plane as possible.
>
> Where should I start? Right now, I'm mostly curious about how to
> determine the relative orientation of the plane to an observer given
> the yaw, pitch, roll, and heading data.

First thought: when viewed from the observer, only two angles are important.
The first is the vertical angle upwards, should be between +90 and -90
(where 0 is straight up). The second is the compass direction for the
observer. This is a (rather) straightforward conversion between the plane's
(X,Y,Z) position (relative to each observer!) into a vector.

> the yaw, pitch, roll, and heading data. I've already figured out how to
> calculate the plane's distance to the observers.

If a close snapshot gets a higher score, yes :-)

[Jongware]