From 54c872fa42b1ba0fdbcfe812b80bb8eb0cfe108f Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 17:37:47 +0800 Subject: *misc --- AddForceToTarget.cs | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 AddForceToTarget.cs (limited to 'AddForceToTarget.cs') 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().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); - } - } -} -- cgit v1.1-26-g67d0