CHAPTER 2 ■ SETTING UP DIFFERENT CAMERA MODES IN YOUR 3D WORLD
63
Extra Reading
Thisrecipepresentedausefulwaytocheckwhetherpointsorobjectsareinsightofthecam-
era.However,whenyouhavealargerscenecontainingplentyofobjects,yourapplication
canbecomeveryslowifyouneedtoperformthistestforeverysingleobjectinyourscene.In
recipe 2-9, a more robust solution is presented that can handle more complex scenes.
2-6. Detect Camera Collision Against Models,
Walls, or Terrains
The Problem
You want to detect when the camera isclosetosolidobjectstopreventitfromentering
anobject.
The Solution
To predict a collision between the camera and a model, you can represent the camera as a
BoundingSphere, of which you can ...