Raycast Bounding Box
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.
Getting ready
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.
How to do it…
Follow these steps to update the Raycast ...
Get Game Physics Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.