💻 Track To constraint¶
- Load
track_to.blend
This scene contains two moving cubes and a single camera.
We would like to keep the camera pointed at one of the cubes as it moves across the scene. We could animate the camera orientation ourselves, but there is an easier way using a constraint. A constraint operates on an object and can influence things like orientation or scale amount based on another object's properties.
We will be using a Track To constraint here, which keeps one object pointing at another object.
- Select the camera
- Switch the Properties panel to the Object Constraints tab using the icon
- In the
Add Object Constraint
menu pickTrack To
underTracking
The Track To constraint will keep the object, in this case our camera, oriented at another object all the time. The other object is called the Target object (in this case one of the cubes).
- In the constraint settings under
Target
(the top one!) pickCube
If you had the 3D View set to view through the active camera (the view will be named Camera Perspective
) one
of the cubes should now be nicely centered in the view.
- Check that when playing the animation the cube indeed stays centered in the camera view.
- Orient the 3D view so you can see the camera's orientation in relation to the scene, specifically the targeted cube.
There is a blue dotted line indicating the constraint between the camera and the cube. To understand how the Track To constraint works in this case we need to understand the basic orientation of a Blender camera.
- Add a new Camera (
Shift-A > Camera
) - Select it and clear its rotation with
Alt-R
. - Zoom in on the new camera so you can see along which axis it is looking. Also note which axis is the Up direction of the camera (i.e. pointing towards the top of the view as seen by this camera).
- Select the original camera we wanted to animate and which has the Track To constraint.
- Change the 3D view so you can see the whole scene, including the selected camera.
Change the
Track Axis
value of the Track To constraint to different values. Also experiment with different values for theUp
setting. Compare these settings against what you concluded from step 10.