|
| |
|
|
|
|
Mathematics behind moving and rotating observer
Wednesday, June 3rd 2009
I have written about the mathematics behind a 3D engine before. However, a 3D engine is pretty much useless if the observer is neither movable nor rotatable. For the case of my Solar System Simulation this capability was considered vital, since I want users to be able to move around the simulation space freely.
Much of everything you would need to make a 3D engine is already in the formula shown above. The terms xE, yE and zE are the position of the observer eyes. If you need to move the observer along any possible axis, all you need to do is to change the value of these variables.
Rotating the Observer Orientation on the other hand is a bit harder. You will need to have a good grasp on Matrix Arithmetic, but if you listen well during your Linear Algebra class, you should be able to follow this tutorial easily.
We start by considering the initial values from the particular case shown in the picture above. The picture above show that the subjective front vector ( Vz )of our observer is pointing toward the x-negative direction, therefore the initial value of Vxz is -1 while the initial values of Vyz and Vzz are 0. By looking at the subjective right vector ( Vx ) and subjective up vector ( Vy ) of the observer as shown in the picture above, we can also deduce that Vxx=0, Vyx=0, Vzx=1, Vxy=0, Vyy=1 and Vzy=0.
You will have to remember that your user will want to rotate their orientation according to their current subjective orientation. That is why you will need to use the formula shown above. Use the first formula for up to left rotation, second formula for front to left rotation and third formula for right to front rotation.
In my Solar System Simulation, I give users the choice for both to move along their subjective orientation vectors and to move along the coordinate axis. I predict that most users are going to feel more comfortable if they can move along their subjective orientation vectors. Therefore, it is advised to use the formula above for rightward, forward or upward move. The value of R is how far you want to move along any particular direction.
Views : 3,038 Views per day : 6.58 Comments : 0
|
|
|
|
| Comments |
| |
| There is no comment for this entry |
|
|
|
|
|