CameraFocus
Description
- Derived from
-
SceneEntityBase abstract
A scene entity that focuses cameras onto a given set of things of interest.
Public / Methods
Apply
Updates the given cameraFocus in object to make it focus on the specified pointsOfInterest in.
The camera focus is applied by performing the following steps:
-
If center in is Vec3D.Undefined, use Box3D.Center of PointsOfInterest.ComputeBounds of pointsOfInterest in instead.
-
Call ICameraFocus.FocusCenter passing center in. This will adjust the camera so that it looks at the center point.
-
Call ICameraFocus.FocusCone to obtain the view cone of the (adjusted) camera and scale the returned cone opening angle with scale opt.
-
Call PointsOfInterest.ComputeOffset passing the adjusted view cone and the scaled cone opening angle. Then call ICameraFocus.FocusOffset passing the resulting offset. This will move the camera forward or backward, so that the adjusted and scaled view cone contains all points of interest.
-
Call ICameraFocus.FocusCone to obtain the view ray of the (translated) camera, pass it to PointsOfInterest.ComputeAngle and divide the returned angle by scale opt. The resulting value is passed to ICameraFocus.FocusAngle, which adjusts the zoom level of the camera.
Applies the camera focus.
This method is called from IUpdateableFrameTime.UpdateFrameTime, so there is usually no need to call it directly. However, when ISceneObject.Enabled is set to false
, this method may be called to apply the camera focus a single time, instead of repeatedly during animation.
The camera focus is applied by iterating over the list of configured ICameraFocus objects (see Add and Remove) and delegating to the static method Apply.