
170 6. Collisions and Entities
In our game code, we don’t want to change the velocity of the ship until all of the other colli-
sions have been calculated. e velocity vector that is added to V1 to get the new V1' is add-
ed to deltaV. e deltaV vector is added to the ship’s velocity in the update function:
deltaV = deltaV + massRatio *(cUV•V1)* cUV,
V1' = V1 + deltaV.
e following code is from the “Planet Collision” example. e calculation of deltaV
is performed in the Entity::bounce function (Listing 6.20).
//========================================================================
// Entity bounces after collision with another entity
//======================================================================== ...