|
|
> Could anyone describe to me a method of checking if an object's bounding
> box can be found within the camera's view cone?
A quick check could work like this (untested code):
#declare cameraConeAngle = 30.0; // you'll have to figure this value out on
your own
#declare cameraPosition = <1,2,3>; // enter camera position
#declare cameraLookAt = <4,5,6>; // enter camera's look_at point
#declare cameraDir = cameraLookAt - CameraPosition;
#macro isPointVisible(point)
#declare returnvalue = false;
#if (acos(vdot(point - cameraPosition, cameraDir)) <= cameraConeAngle)
#declare returnvalue = true;
#end
returnvalue
#end
Then just use the isPointVisible macro on each corner of the object's
bounding box.
- Slime
[ http://www.slimeland.com/ ]
Post a reply to this message
|
|