Changing the camera
Every 3D view (TForm3D
or TViewPort3D
) has the concept of a camera to capture objects in the 3D world. The default camera used at design time points at the very center of the area but is located back from the screen, toward the viewer (-20 on the z axis). This gives a nice, viewable area of your 3D world.
But this is just the start—there can be several cameras.
Multiple cameras
You can add one or more cameras and switch between them and the default one. Their position and rotation can be customized to the specific views you're after, and if you want one of them to focus on one object, you can set the Target
property to that object. Any change to a camera view at runtime requires a call to the camera's Repaint
method to tell the output about the updated camera view.
Here are the steps to add a camera view that focuses on the elk—and how to switch it at runtime:
- Add a
TCamera
component to the form and set itsPosition
properties...