Game Development Reference
In-Depth Information
Chapter 3
3D Math Review
In this chapter, I cover vectors and matrices. Vectors and matrices are key to 3D game programming
in terms of such things as determining the placement of 3D objects in the scene and how a 3D object
is projected onto a 2D screen. Vectors can also be used for defining properties such as velocity and
force. I start by discussing vectors and operations that can be performed with vectors. I then cover
matrices and the essential operations related to 3D graphics that can be performed with matrices.
Finally, I present a hands-on example that will demonstrate how vectors and matrices are actually
used in a real 3D graphics program on an Android device.
Vectors and Vector Operations
Vectors are an essential topic related to 3D graphics. In this section, I will cover what vectors are
and what they are used for. I also cover important vector functions, such as dot products and
cross products.
What Is a Vector?
A vector is a quantity that has direction and magnitude. For the purposes of this topic, vectors will
be 3D vectors, with components in the x, y, and z direction in the 3D world. Vectors can represent
things such as position, velocity, direction, an object's rotation axis, an object's local axes, and
forces acting on an object. On Android in OpenGL ES, the coordinate system consists of the
x and z axes forming the ground plane and the y axis indicating height (see Figure 3-1 ).
57
 
Search WWH ::




Custom Search