From 766cdff5ffa72b65d7f106658d1603f47739b2ba Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 27 Oct 2023 11:05:14 +0800 Subject: + init --- GameCode/RotationHandler.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 GameCode/RotationHandler.cs (limited to 'GameCode/RotationHandler.cs') diff --git a/GameCode/RotationHandler.cs b/GameCode/RotationHandler.cs new file mode 100644 index 0000000..121bda8 --- /dev/null +++ b/GameCode/RotationHandler.cs @@ -0,0 +1,21 @@ +using UnityEngine; + +public class RotationHandler : MonoBehaviour +{ + private CharacterData data; + + private PlayerVelocity rig; + + public float torque; + + private void Start() + { + data = GetComponent(); + rig = GetComponent(); + } + + private void FixedUpdate() + { + rig.AddTorque(torque * TimeHandler.timeScale * (Vector3.Angle(Vector3.up, base.transform.up) * Vector3.Cross(Vector3.up, base.transform.up).normalized).z); + } +} -- cgit v1.1-26-g67d0