Many games involve directional playermovement without strafing. Instead we see character models rotating to face the direction of the input and move in that direction. In this script I incorporate the simple Move script within character controller and I added additional code to rotate the character model towards the direction of input.
void Update ()
{
CharacterController controller = GetComponent<CharacterController>();
if (controller.isGrounded) { //If we're on the ground
if(movementEnabled) //When we're allowed to move
{
moveDirection = new Vector3(Input.GetAxis("Left/Right"), 0, Input.GetAxis("Down/Up"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= skateSpeed;
transform.rotation *= Quaternion.AngleAxis(new Vector3(Input.GetAxis("Left/Right"), 0, 0));
Currently the transform.rotation has the error " No overload for method AngleAxis' takes 1’ arguments". However, it is still unclear to me for how to use quaternion for this commonly used method of player movement.
Thanks for the help!