CHAPTER 4 ■ WORKING WITH MODELS
378
4-18. Detect Ray-Model Collisions Using
Per-Triangle Checks
The Problem
You want to check whether a 3D ray collides with a Model. This is required if you want to per-
form collision detection at the finest level of detail. It can be used as an extension to recipe
4-11 to detect at a high level of detail whether a bullet has hit an object. As shown in the next
recipe, this can, for example, also be used to check whether the pointer is currently over a
Model.
Evenmore,thiscanbeusedasanultrafinecheckforModel-to-Model collisions, because
each edge of a triangle corresponds to a Ray that can be tested for collisions with another
Model.
This recipe will deal with the most complex case, allowing separate ...