Math for Game Programmers
Math for building 3D games. Points, vectors, normals. Dot and cross products. Transformations and inverses in left- and right-handed systems. Uses for controlling objects, cameras, and texture manipulation. Bounding boxes, planes, frustums for collision detection and visibility, fast billboarding techniques, point and sphere sweeping. Quaternions.
Study notes
Independent, AI-drafted study guide · Public sources linked below · Added November 5, 2026
Independent mathematics guide aligned with the public Fall 2026 outline. Engine documentation supplies supplementary worked interpretations; coordinate, matrix, and handedness conventions must be checked against the engine used in class.
Points, displacement, and coordinate conventions
A point describes a position in a coordinate system; a vector describes displacement or direction. Subtracting points produces a vector, while adding a displacement to a point produces another point. The vector (3, 4, 0) has length 5, so its unit direction is (0.6, 0.8, 0). Normalize only when length is nonzero. Keep units consistent: multiplying a velocity measured in metres per second by seconds produces metres. State which axis is up and whether the coordinate system is left-handed or right-handed before interpreting rotations.
References: COMP 1008 — Fall 2026 course outline · Godot Engine — Math tutorials
Dot products, cross products, and normals
The dot product measures alignment: a dot b = |a||b| cos(theta). With unit vectors it equals the cosine of the angle, making it useful for field-of-view and facing tests. The cross product produces a perpendicular vector with magnitude equal to the parallelogram area. Its sign depends on operand order and the coordinate convention. A surface normal describes orientation rather than position. For nonuniform scaling, transforming normals like ordinary directions can make them cease to be perpendicular; use the inverse transpose of the linear transform and renormalize.
References: COMP 1008 — Fall 2026 course outline · Godot Engine — Math tutorials
Matrices, homogeneous coordinates, and inverse transforms
A transform combines scale, rotation, and translation. Homogeneous coordinates allow translation to join matrix multiplication: points use w = 1, directions use w = 0. With column vectors, the rightmost matrix acts first. Therefore translate-then-rotate generally differs from rotate-then-translate. An inverse maps world coordinates back to a local frame when the transform is invertible. A camera view matrix is conceptually the inverse of the camera’s world transform. A zero scale destroys information, so the corresponding transform cannot have a full inverse.
References: COMP 1008 — Fall 2026 course outline · Godot Engine — Math tutorials
Planes, bounds, and conservative tests
A plane can be expressed as n dot x + d = 0. For a unit normal, this expression gives signed perpendicular distance. A sphere with centre c and radius r lies wholly on the positive side when n dot c + d > r. Bounding boxes and spheres provide cheap broad-phase rejection before costly exact geometry checks. A view frustum is a collection of clipping half-spaces. Conservative culling may keep an invisible object, but it should not discard visible geometry; assess the effect of numerical tolerances near boundaries.
References: COMP 1008 — Fall 2026 course outline · Godot Engine — Math tutorials
Sweeping and a worked collision calculation
Discrete collision tests examine isolated moments and can miss a fast object crossing a thin obstacle. A sweep examines the path over an interval. Suppose a point starts at x = 1, moves at 6 units per second, and approaches the plane x = 4. Solve 1 + 6t = 4 to obtain t = 0.5 seconds. A radius-0.5 sphere touches the same plane when its centre reaches 3.5, at t = 2.5/6 seconds. Check the valid time interval and whether the object is moving toward the surface.
References: COMP 1008 — Fall 2026 course outline · Godot Engine — Math tutorials
Interpolation, billboards, and quaternions
Linear interpolation combines endpoints as (1 - t)a + tb for t between zero and one. It is useful for positions but does not generally preserve rotation constraints. Unit quaternions represent rotations compactly and can interpolate orientation smoothly. The quaternions q and -q represent the same orientation, so interpolation often chooses signs to use the shorter arc. Quaternion multiplication composes rotations and is order-sensitive. A billboard constructs an orientation that faces a camera; choose a stable fallback when the desired facing direction becomes parallel to the chosen up vector.
References: COMP 1008 — Fall 2026 course outline · Godot Engine — Math tutorials
Practice & worked answers
Original exercises for this guide.
1. For unit directions a = (1,0,0) and b = (0,1,0), what is their angle?
Show worked answer
Their dot product is zero, hence cos(theta) = 0 and the angle is 90 degrees. Their cross product is perpendicular to both.
2. Why does translation affect a point but not a velocity?
Show worked answer
A point has an origin-dependent position, whereas velocity is displacement per time. In homogeneous coordinates the translation term is multiplied by w, which is one for points and zero for directions.
3. A sphere centre is distance 3 from a plane and its radius is 2. Does it intersect the plane?
Show worked answer
No. Intersection requires the absolute signed distance to be at most the radius. Here 3 > 2, leaving a one-unit gap.
Public notes & references
Course sources establish the scope above. Reference materials support the explanations; linked lecture notes and books remain with their authors.
Prerequisites & course information
Prerequisite(s): one Grade 12 university preparation mathematics course. Lectures three hours a week, tutorial one and a half hours a week.
Sources
- Course catalogue ↗2026–2027
- Math for Game Programmers ↗2026