aboutsummaryrefslogtreecommitdiff
path: root/Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs
diff options
context:
space:
mode:
authorTom Harley2018-09-03 23:34:21 +0100
committerTom Harley2018-09-03 23:36:01 +0100
commit5440734d820606b29a795c46172ade5d7eba8efb (patch)
tree85867f40afb02cfa2a5028b515ed0a195866b7e9 /Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs
downloadpowerless-5440734d820606b29a795c46172ade5d7eba8efb.tar.gz
powerless-5440734d820606b29a795c46172ade5d7eba8efb.zip

Initial commit

Diffstat (limited to 'Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs')
-rw-r--r--Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs b/Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs
new file mode 100644
index 0000000..e53ed32
--- /dev/null
+++ b/Assets/Cinemachine/Base/Runtime/Components/CinemachineHardLockToTarget.cs
@@ -0,0 +1,33 @@
+using UnityEngine;
+
+namespace Cinemachine
+{
+ /// <summary>
+ /// This is a CinemachineComponent in the Aim section of the component pipeline.
+ /// Its job is to place the camera on the Follow Target.
+ /// </summary>
+ [DocumentationSorting(23, DocumentationSortingAttribute.Level.UserRef)]
+ [AddComponentMenu("")] // Don't display in add component menu
+ [RequireComponent(typeof(CinemachinePipeline))]
+ [SaveDuringPlay]
+ public class CinemachineHardLockToTarget : CinemachineComponentBase
+ {
+ /// <summary>True if component is enabled and has a LookAt defined</summary>
+ public override bool IsValid { get { return enabled && FollowTarget != null; } }
+
+ /// <summary>Get the Cinemachine Pipeline stage that this component implements.
+ /// Always returns the Aim stage</summary>
+ public override CinemachineCore.Stage Stage { get { return CinemachineCore.Stage.Body; } }
+
+ /// <summary>Applies the composer rules and orients the camera accordingly</summary>
+ /// <param name="curState">The current camera state</param>
+ /// <param name="deltaTime">Used for calculating damping. If less than
+ /// zero, then target will snap to the center of the dead zone.</param>
+ public override void MutateCameraState(ref CameraState curState, float deltaTime)
+ {
+ if (IsValid)
+ curState.RawPosition = FollowTarget.position;
+ }
+ }
+}
+