Browse Source

Added axis lock to player prefabs

feature/RoundManager
Joshua Reason 3 years ago
parent
commit
5a91cc28da
1 changed files with 5 additions and 3 deletions
  1. +5
    -3
      Assets/Scripts/Player Scripts/PlayerInputController.cs

+ 5
- 3
Assets/Scripts/Player Scripts/PlayerInputController.cs View File

@ -42,6 +42,7 @@ public class PlayerInputController : MonoBehaviour
{
ApplyRotation();
ApplyMovement();
LockAxis(Vector3.up);
}
@ -70,7 +71,8 @@ public class PlayerInputController : MonoBehaviour
m_controller.Move(transform.forward * speed * Time.deltaTime);
}
private void LockAxis(Vector3 axis)
{
transform.position = Vector3.ProjectOnPlane(transform.position, axis);
}
}

Loading…
Cancel
Save