diff options
Diffstat (limited to 'AddForceToTarget.cs')
-rw-r--r-- | AddForceToTarget.cs | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/AddForceToTarget.cs b/AddForceToTarget.cs deleted file mode 100644 index 9464c97..0000000 --- a/AddForceToTarget.cs +++ /dev/null @@ -1,26 +0,0 @@ -using UnityEngine; - -public class AddForceToTarget : MonoBehaviour -{ - public AnimationCurve forceByRangeCurve; - - public Rigidbody target; - - public float force; - - private Transform head; - - private void Start() - { - head = GetComponentInChildren<Head>().transform; - } - - private void FixedUpdate() - { - float num = forceByRangeCurve.Evaluate(Vector3.Distance(head.position, target.position)) * force; - if (num > 0f) - { - target.AddForce((head.position - target.position).normalized * num, ForceMode.Force); - } - } -} |