
6
Collisions and Entities
In this chapter, we will add a new Entity class to the game engine. One of the new features
of the Entity class is the ability to collide with other entities. In addition to colliding,
entities will also have the ability to react to collisions. e code for collision detection and
reaction will be part of the Entity class. Many of the calculations we need to perform for
the collision code will use vectors and vector math, so we will start this chapter by taking a
look at vectors.
6.1 Vectors
A vector represents both length and direction. We will dene a vector by the x and y coor-
dinates of its end point. DirectX has D3DXVECTOR2 ...