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.
A mathematical vector (not to be confused with
std::vector) represents both a magnitude and direction in an n-dimensional space, with one component ...