diff options
Diffstat (limited to 'ROUNDS/RotationHandler.cs')
-rw-r--r-- | ROUNDS/RotationHandler.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ROUNDS/RotationHandler.cs b/ROUNDS/RotationHandler.cs new file mode 100644 index 0000000..121bda8 --- /dev/null +++ b/ROUNDS/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<CharacterData>(); + rig = GetComponent<PlayerVelocity>(); + } + + private void FixedUpdate() + { + rig.AddTorque(torque * TimeHandler.timeScale * (Vector3.Angle(Vector3.up, base.transform.up) * Vector3.Cross(Vector3.up, base.transform.up).normalized).z); + } +} |