Any box in 3D space, OBB, or AABB has six sides. This means the normal of a Raycast
against a box will be the normal of one of the six sides. When doing a Raycast
against a Bounding Box, we find the point of impact the same way we did for a Raycast
against a Sphere. The normal, however, will be the same as the normal of the side which the ray hit.
Several of our existing functions use Raycast
against AABB or OBB internally. When we change the API, we must be careful to update every spot where these functions are used. We must update the Linetest
functions and the MeshRay
function. In this section we are going to rewrite the Raycast
function for AABB and OBB.