Raycast Oriented Bounding Box

We can extend the same slab method used for raycasting against an AABB to also work with an OBB. The key difference is how we find the values of Raycast Oriented Bounding Box and Raycast Oriented Bounding Box.

Getting ready

We are going to implement a function that finds the entry and exit points of a Raycast against an OBB. This function will only return the entry point. The function returns a scalar value t. This scalar value is the time along the ray at which the intersection happened. If the intersection is invalid, a negative number is returned.

How to do it…

Follow these steps ...

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.