diff options
author | chai <215380520@qq.com> | 2024-03-13 17:37:47 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2024-03-13 17:37:47 +0800 |
commit | 54c872fa42b1ba0fdbcfe812b80bb8eb0cfe108f (patch) | |
tree | 5d7e1b1b33ef67f147f92a912e2ab371e83ec490 /AddForceToTarget.cs | |
parent | 134f1deb971b0514a26e04e23926f91983a5497f (diff) |
*misc
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); - } - } -} |