Class Cinemachine3rdPersonFollow
Third-person follower, with complex pivoting: horizontal about the origin, vertical about the shoulder.
Inheritance
Implements
Inherited Members
Namespace: Unity.Cinemachine
Assembly: Unity.Cinemachine.dll
Syntax
[Obsolete("Cinemachine3rdPersonFollow has been deprecated. Use CinemachineThirdPersonFollow instead")]
[CameraPipeline(CinemachineCore.Stage.Body)]
[RequiredTarget(RequiredTargetAttribute.RequiredTargets.Tracking)]
[AddComponentMenu("")]
[HelpURL("https://docs.unity3d.com/Packages/com.unity.cinemachine@3.1/manual/Cinemachine3rdPersonFollow.html")]
public class Cinemachine3rdPersonFollow : CinemachineComponentBase, CinemachineFreeLookModifier.IModifierValueSource, CinemachineFreeLookModifier.IModifiablePositionDamping, CinemachineFreeLookModifier.IModifiableDistance
Fields
CameraCollisionFilter
Camera will avoid obstacles on these layers.
Declaration
[Header("Obstacles")]
[Tooltip("Camera will avoid obstacles on these layers")]
public LayerMask CameraCollisionFilter
Field Value
Type | Description |
---|---|
LayerMask |
CameraDistance
How far behind the hand the camera will be placed.
Declaration
[Tooltip("How far behind the hand the camera will be placed")]
public float CameraDistance
Field Value
Type | Description |
---|---|
float |
CameraRadius
Specifies how close the camera can get to obstacles
Declaration
[Tooltip("Specifies how close the camera can get to obstacles")]
[Range(0, 1)]
public float CameraRadius
Field Value
Type | Description |
---|---|
float |
CameraSide
Specifies which shoulder (left, right, or in-between) the camera is on.
Declaration
[Tooltip("Specifies which shoulder (left, right, or in-between) the camera is on")]
[Range(0, 1)]
public float CameraSide
Field Value
Type | Description |
---|---|
float |
Damping
How responsively the camera tracks the target. Each axis (camera-local) can have its own setting. Value is the approximate time it takes the camera to catch up to the target's new position. Smaller values give a more rigid effect, larger values give a squishier one.
Declaration
[Tooltip("How responsively the camera tracks the target. Each axis (camera-local) can have its own setting. Value is the approximate time it takes the camera to catch up to the target's new position. Smaller values give a more rigid effect, larger values give a squishier one")]
public Vector3 Damping
Field Value
Type | Description |
---|---|
Vector3 |
DampingFromCollision
How gradually the camera returns to its normal position after having been corrected by the built-in collision resolution system. Higher numbers will move the camera more gradually back to normal.
Declaration
[Range(0, 10)]
[Tooltip("How gradually the camera returns to its normal position after having been corrected by the built-in collision resolution system. Higher numbers will move the camera more gradually back to normal.")]
public float DampingFromCollision
Field Value
Type | Description |
---|---|
float |
DampingIntoCollision
How gradually the camera moves to correct for occlusions.
Higher numbers will move the camera more gradually.
Declaration
[Range(0, 10)]
[Tooltip("How gradually the camera moves to correct for occlusions. Higher numbers will move the camera more gradually.")]
public float DampingIntoCollision
Field Value
Type | Description |
---|---|
float |
IgnoreTag
Obstacles with this tag will be ignored. It is a good idea to set this field to the target's tag
Declaration
[Tooltip("Obstacles with this tag will be ignored. It is a good idea to set this field to the target's tag")]
public string IgnoreTag
Field Value
Type | Description |
---|---|
string |
ShoulderOffset
Position of the shoulder pivot relative to the Follow target origin.
This offset is in target-local space.
Declaration
[Header("Rig")]
[Tooltip("Position of the shoulder pivot relative to the Follow target origin. This offset is in target-local space")]
public Vector3 ShoulderOffset
Field Value
Type | Description |
---|---|
Vector3 |
VerticalArmLength
Vertical offset of the hand in relation to the shoulder.
Arm length will affect the follow target's screen position
when the camera rotates vertically.
Declaration
[Tooltip("Vertical offset of the hand in relation to the shoulder. Arm length will affect the follow target's screen position when the camera rotates vertically")]
public float VerticalArmLength
Field Value
Type | Description |
---|---|
float |
Properties
IsValid
True if component is enabled and has a Follow target defined
Declaration
public override bool IsValid { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
Stage
Get the Cinemachine Pipeline stage that this component implements. Always returns the Aim stage
Declaration
public override CinemachineCore.Stage Stage { get; }
Property Value
Type | Description |
---|---|
CinemachineCore.Stage |
Overrides
Methods
GetMaxDampTime()
Report maximum damping time needed for this component.
Declaration
public override float GetMaxDampTime()
Returns
Type | Description |
---|---|
float | Highest damping setting in this component |
Overrides
GetRigPositions(out Vector3, out Vector3, out Vector3)
Internal use only. Public for the inspector gizmo
Declaration
public void GetRigPositions(out Vector3 root, out Vector3 shoulder, out Vector3 hand)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | root | Root of the rig. |
Vector3 | shoulder | Shoulder of the rig. |
Vector3 | hand | Hand of the rig. |
MutateCameraState(ref CameraState, float)
Orients the camera to match the Follow target's orientation
Declaration
public override void MutateCameraState(ref CameraState curState, float deltaTime)
Parameters
Type | Name | Description |
---|---|---|
CameraState | curState | The current camera state |
float | deltaTime | Elapsed time since last frame, for damping calculations. |
Overrides
OnTargetObjectWarped(Transform, Vector3)
This is called to notify the user that a target got warped, so that we can update its internal state to make the camera also warp seamlessly.
Declaration
public override void OnTargetObjectWarped(Transform target, Vector3 positionDelta)
Parameters
Type | Name | Description |
---|---|---|
Transform | target | The object that was warped |
Vector3 | positionDelta | The amount the target's position changed |