|
|
@ -9,7 +9,7 @@ public class PlayerInputController : InputBehaviour |
|
|
|
|
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
private float m_playerSpeed = 1; |
|
|
|
public float m_playerSpeed = 1; |
|
|
|
|
|
|
|
[SerializeField] |
|
|
|
private float m_rotationSpeed = 1; |
|
|
@ -29,10 +29,13 @@ public class PlayerInputController : InputBehaviour |
|
|
|
private Vector3 m_desiredDirection; |
|
|
|
private bool m_recievedInput => m_desiredDirection.magnitude != 0; |
|
|
|
|
|
|
|
public Vector3 m_CameraForwards; |
|
|
|
|
|
|
|
|
|
|
|
private void Awake() |
|
|
|
{ |
|
|
|
m_controller = GetComponent<CharacterController>(); |
|
|
|
//m_CameraForwards = Vector3.ProjectOnPlane(Camera.main.transform.forward,Vector3.up).normalized;
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -53,16 +56,11 @@ public class PlayerInputController : InputBehaviour |
|
|
|
|
|
|
|
private void ApplyRotation() |
|
|
|
{ |
|
|
|
transform.forward = Vector3.Slerp(transform.forward, m_desiredDirection.normalized, m_rotationSpeed * Time.deltaTime); |
|
|
|
transform.forward = Vector3.Slerp(transform.forward, m_desiredDirection, m_rotationSpeed * Time.deltaTime); |
|
|
|
} |
|
|
|
|
|
|
|
private void ApplyMovement() |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
float forwardRatio = (Vector3.Dot(transform.forward, m_desiredDirection.normalized) + 1) / 2; |
|
|
|
float speed = m_turnRadius.Evaluate(forwardRatio) * m_playerSpeed; |
|
|
|
m_legAnimator.SetFloat("Movement", speed); |
|
|
@ -70,7 +68,7 @@ public class PlayerInputController : InputBehaviour |
|
|
|
if (!m_recievedInput) |
|
|
|
return; |
|
|
|
|
|
|
|
m_controller.Move(transform.forward * speed * Time.deltaTime); |
|
|
|
m_controller.Move(transform.forward.normalized * speed * Time.deltaTime); |
|
|
|
} |
|
|
|
|
|
|
|
private void LockAxis(Vector3 axis) |
|
|
|