- Makes a GameObject turn to look at an object.
This is similar to a LookAt Constraint except that it interpolates (rotates) toward the target. This has a smoothing effect so if the target moves really fast, or a new target is added, the constrainted object will not snap instantly to the new rotation. This is great for the heads of characters and gun turrets. In fact, this constraint is the only thing making all of our towers aim at targets for our Tower Defense game. We give this constraint a target whenever there is an update, and the constraint does the rest!
- Target
- The object which the constrained object will face.
- Mode
- (See Documentation)
- No Target Mode
- (See Documentation)
- Point Axis
- (See LookAt Constraint)
- Up Axis
- (See LookAt Constraint)
- Up Target
- (See LookAt Constraint)
- Interpolation
-
- Linear
- The fastest, but may not look as good as Spherical when rotations are far apart, e.g. turning to face something behind you. This interpolates by finding the shortest straight line between two quaternions. The reason this isn't as nice when rotations are far apart is because a linear path is essentially a shortcut which doesn't care about the spherical nature of a rotation. It will therefore move faster at the mid point around a rotation. if moving only small steps, however, this will work fine
- Spherical
- The smoothest result and usually what you want to use (unless you want the speed limited, see below).This interpolates by finding the shortest line along a spherical path between two quaternions. Unlike Linear, no "shortcut" is taken.
- Spherical Limited
- The same as Spherical but limits the maximum speed of the rotation. This is perfect for mechanical objects like a gun turret or simply to add a threshold when fast super-fast rotations are causing issues with physics, etc. This will still be smooth as it only limits the upper speed of the rotation. It will not force a constant speed.
Speed
The speed of the rotation. Regardless of the interpolation mode, the speed will still influence the result.
Output
- WorldAll
- Outputs the final solution to all axis to interpolate exactly between the last frame rotation and the target.
- World...
- Will output a result relative to the chosen axis in world space.
- Local...
- Will output relative to the parent of the constrained object. If not using WorldAll, these are the next most common options.
- This is how you would create a gun turret with separate objects for pan and tilt. Put one of these constraints on each object and set one to rotate around Y and the other around X, for example. Set the target on both constraints to make the turret turn and point.
|
|