Completing the Physics Engine and Rigid Shape Component
In the previous chapter, you have implemented algorithms to detect collisions between rigid circles and rectangles. In addition to the Boolean condition of whether a collision has indeed occurred, the algorithms you have implemented also computed information that tells you important details—the collision information, which includes the interpenetration depth and normal direction. In this chapter, you will further expand the physics engine by using the collision information to correct the interpenetration condition, and learn about simulating collision responses that resemble real-world rigid shape behaviors. Initially, your responses will be in linear motion, and finally you will support objects rotating as a result of collisions.