Using matrices
Matrices are used in 3D games a lot. The reason we use them is because they make our life easy. We could use regular trigonometry to map all our movement, but doing this for each axis would make it a hazardous task. Instead we can use matrices to wrap it all in one neat little package. We won't go into detail about how a matrix works, but we will explain how to use them. It is important however that we know what a matrix is: a matrix, or more specifically the four by four matrices we will be using, is a structure composed of 16 values that together define a transformation in 3D space. There are a couple of concepts we will come in contact with:
World: A world matrix contains the position, the rotation, and the scale of an object.
View: The view matrix contains the inverse of the camera's world matrix. This is because it will transform our vertices so they are seen from the camera.
Projection: The projection matrix contains the lens settings of our camera.
If we want to position...