This is a problem for 3d graphics programming.
I have an object in 3d space, an airplane, who's position is (x1, y1, z1). The orientation (rotation) specified as a Euler vector in radians, (x2, y2, z2).
The airplane will be moving and rotating. I will want to place the camera at location (x4, y4, z4), which needs to be calculated. It will be calculated from a specified translation vector, (x3, y3, z3), where the vector is with respect to the airplane's space, rather than the 3d environment. This translation vector might be specified such that the camera is always looking at the rear of the airplane, or the top of the airplane, etc., irrespective of the airplane's orientation and position.
In other words, I may want to have the camera stay 2 units behind the airplane. So the translation vector I specify might be (2, 0, 0). Situation 1: If the airplane's position vector is (0,0,0) and its rotation vector is (0,0,0), then the camera position would be (2,0,0). Situation 2: If the airplane's position vector is (0,0,0) but its rotation vector is NOT (0,0,0), then the camera's position vector would NOT be (2,0,0).
I hope this makes sense.
What operations would I need to undertake to achieve:
- airplane position vector
- airplane rotation vector
- camera translation vector (with respect to airplane, given position AND rotation )
- camera's position vector