using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharcterMotor : MonoBehaviour
{
public float moveSpeed = 10;
public float rotateSpeed = 50;
private void Update()
{
float hor = Input.GetAxis("Horizontal");
float ver = Input.GetAxis("Vertical");
MovementRotateion(hor, ver);
}
private void MovementRotateion(float hor,float ver)
{
if (hor != 0 || ver != 0)
{
Quaternion dir = Quaternion.LookRotation(new Vector3(hor, 0, ver));
this.transform.rotation = Quaternion.Lerp(this.transform.rotation,dir,Time.deltaTime * rotateSpeed);
this.transform.Translate(0, 0, -Time.deltaTime * moveSpeed);
}
}
}