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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.