Operations on models

We want to perform the same operations on models that we performed on Meshes. The only difference is that models should account for the world space of the model. The best way to achieve this is to transform the primitive being tested by the inverse world matrix of the model. When we transform anything by the inverse world space of the model, we move that thing into the local space of the model. The untransformed mesh happens to be in the local space of the model.

Getting ready

We are going to implement seven functions to test a model for intersection against rays, lines, spheres, AABBs, OBBs, planes, and triangles. Each of the intersection functions will transform the primitive by the inverse world matrix of the model, and then ...

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.