I'm learning some OpenGL game programming, and how I'm stuck in implementing so that the camera mouse pointer like FPS game You want to see where your mouse is showing, but when I am walking, I can not find a good solution. While using Quaternians to handle the rotation, I was thinking of saving a matrix for movements like conduction and struffing. Then construct the quadrilateral in the rotation matrix, load the identification for this matrix with both the model matrix and the matrix.
There are some problems with this, such as the use of the matrix we should first multiply, and the code will be ugly.
So I'm thinking that anyone is getting a good solution to solve it, so I do not have to figure out which matrix to use first, and which gives cleaner code. / P>
Store the scene details of the camera in the status vector, as a view-vector and an up-vector (Think out with your thumb, pointing out: your finger is visible-vector, and your thumb is up-vector) Keep these vectors normalized and keep each other up to 90 degrees. You should be able to see that these three vectors are enough to represent the position and orientation of any camera.
- <
- -
- Rotate around (Up-vector 'cross' y-axis) - (angle between the up-vector and y-axis) ;; By the up-vector - (angle between the visible-vector and z-axis).
(I can get some wrong signals around me).
You can change these vectors because the user transmits the mouse:
- As the mouse moves on the edge, rotate the view-vector around the ve-vector (Or rotate both the view-vector and up-vector if you prefer around the y-axis).
- As the mouse moves forward / forward, both revolve around the visual-vector and up-vector (view-vector 'cross' up-vector).
Comments
Post a Comment