Class TargetPositionCache
Use this class to support caching of Cinemachine target positions and rotations for the purposes of timeline scrubbing in the Editor. At runtime, the public methods in this class simply return the uncached values from the target's transform.
Cinemachine behaviours and extensions that support timeline scrubbing should use the GetTargetPosition and GetTargetRotation static methods when accessing the target's position or rotation.
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
public class TargetPositionCache
Methods
GetTargetPosition(Transform)
When using Timeline in Edit mode:
- If you're Recording, the method logs the target position at the CurrentTime.
- Otherwise, it fetches the cached position at CurrentTime.
When using Timeline in Play mode, and when you're not scrubbing it:
- The method returns the position directly from the Transform.
Declaration
public static Vector3 GetTargetPosition(Transform target)
Parameters
Type | Name | Description |
---|---|---|
Transform | target | Target whose transform is tracked |
Returns
Type | Description |
---|---|
Vector3 | The effective position of the target. |
GetTargetRotation(Transform)
When using Timeline in Edit mode:
- If you're Recording, the method logs the target position at the CurrentTime.
- Otherwise, it fetches the cached position at CurrentTime.
When using Timeline in Play mode, and when you're not scrubbing it:
- The method returns the position directly from the Transform.
Declaration
public static Quaternion GetTargetRotation(Transform target)
Parameters
Type | Name | Description |
---|---|---|
Transform | target | Target whose transform is tracked |
Returns
Type | Description |
---|---|
Quaternion | The effective position of the target. |