From 134f1deb971b0514a26e04e23926f91983a5497f Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Wed, 13 Mar 2024 11:38:18 +0800 Subject: * move --- RotationHandler.cs | 73 ------------------------------------------------------ 1 file changed, 73 deletions(-) delete mode 100644 RotationHandler.cs (limited to 'RotationHandler.cs') diff --git a/RotationHandler.cs b/RotationHandler.cs deleted file mode 100644 index ee33545..0000000 --- a/RotationHandler.cs +++ /dev/null @@ -1,73 +0,0 @@ -using UnityEngine; - -public class RotationHandler : MonoBehaviour -{ - private Transform rotationTarget; - - private Rigidbody hip; - - private Rigidbody torso; - - private Rigidbody head; - - public float rotationTorque; - - public float clamp; - - private InputHandler input; - - private PlayerDeath death; - - [HideInInspector] - public float hipCorrectionAmount; - - public bool useHip = true; - - public bool useTorso = true; - - public bool useHead = true; - - private void Start() - { - death = GetComponent(); - rotationTarget = GetComponentInChildren().transform; - hip = GetComponentInChildren().GetComponent(); - torso = GetComponentInChildren().GetComponent(); - head = GetComponentInChildren().GetComponent(); - input = GetComponent(); - } - - private void FixedUpdate() - { - if (!death.dead) - { - float num = head.transform.InverseTransformPoint(rotationTarget.position).x; - float num2 = torso.transform.InverseTransformPoint(rotationTarget.position).x; - hipCorrectionAmount = hip.transform.InverseTransformPoint(hip.transform.position + input.lastInputDirection * 10f).x; - float muscleFunction = death.muscleFunction; - float num3 = 0.3f; - if (input.inputMovementDirection.magnitude > 0.1f) - { - num3 = 1f; - } - if (clamp != 0f) - { - hipCorrectionAmount = Mathf.Clamp(hipCorrectionAmount, 0f - clamp, clamp); - num = Mathf.Clamp(num, 0f - clamp, clamp); - num2 = Mathf.Clamp(num2, 0f - clamp, clamp); - } - if (useHip) - { - hip.AddTorque(Vector3.up * muscleFunction * rotationTorque * num3 * hipCorrectionAmount, ForceMode.Acceleration); - } - if (useTorso) - { - torso.AddTorque(Vector3.up * muscleFunction * rotationTorque * num2, ForceMode.Acceleration); - } - if (useHead) - { - head.AddTorque(Vector3.up * muscleFunction * rotationTorque * num, ForceMode.Acceleration); - } - } - } -} -- cgit v1.1-26-g67d0