Springs
We briefly introduced springs in Chapter 16, Springs and Joints. We saw how we can use springs to create soft bodies like cloth. In this section, we will explore other uses of springs.
Collision resolution
If we know the collision point, depth, and normal, we can use springs to resolve the collision. This method works by placing a temporary spring at the point of contact that will push objects apart in the direction of the contact normal. The spring should exert just enough force to push the two bodies apart.
The force that the spring exerts on the rigid bodies is called a penalty force. Due to this terminology, using springs to resolve collisions is often called penalty based collision resolution; the following image demonstrates this:
While this method can be used to create stable physics, finding the right k value for the springs often becomes a guessing game. Using the wrong k value can lead to excessive jitter and bouncy objects. Due to the difficulty in finding the right k value...