Chapter 3
Vectors and Basic Physics
Vectors are a fundamental mathematical concept that game programmers use every day. This chapter first explores all the different ways vectors can be used to solve problems in games. Next, it shows how to implement basic movement through a MoveComponent and control it with the keyboard via an InputComponent. This chapter then briefly explores the basics of Newtonian physics before ending with a discussion of how to detect collisions between objects. This chapter’s game project uses some of these techniques to implement a version of the classic game Asteroids.
Vectors
A mathematical vector (not to be confused with std::vector
) represents both a magnitude and direction in an n-dimensional space, with one component ...
Get Game Programming in C++: Creating 3D Games, First Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.