Response
Summary:
After detecting a collision, we need to move the shapes appropriately.
If we’re using reality based physics, then we have to apply physics laws.
In the following chapters, we will see how to update things appropriately.
For the following chapters, we consider the narrow phase is returning a CollisionInfo:
struct CollisionInfo
{
float mtv; // Minimum Translation Vector
Vec3 collisionPoint;
Vec3 normal;
};
void RunPhysicalResponse(Shape* shape1, Shape* shape2, const CollisionInfo& collisionInfo)
{
RunCorrection(shape1, shape2, collisionInfo);
UpdateVelocity(shape1, shape2, collisionInfo);
UpdateAngularVelocity(shape1, shape2, collisionInfo);
}