How do I create a camera?
- by Morphex
I am trying to create a generic camera class for a game engine, which works for different types of cameras (Orbital, GDoF, FPS), but I have no idea how to go about it.
I have read about quaternions and matrices, but I do not understand how to implement it. Particularly, it seems you need "Up", "Forward" and "Right" vectors, a Quaternion for rotations, and View and Projection matrices.
For example, an FPS camera only rotates around the World Y and the Right Axis of the camera; the 6DoF rotates always around its own axis, and the orbital is just translating for a set distance and making it look always at a fixed target point.
The concepts are there; implementing this is not trivial for me.
SharpDX seems to have has already Matrices and Quaternions implemented, but I don't know how to use them to create a camera.
Can anyone point me on what am I missing, what I got wrong?
I would really enjoy if you could give a tutorial, some piece of code, or just plain explanation of the concepts.