summaryrefslogtreecommitdiff
path: root/GameCode/RotationHandler.cs
blob: 121bda819c6fe66e7bcc33c870ea73d48f015f15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
	}
}