using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour{
[SerializeField]
private float walkSpeed;
private Rigidbody myRigid;
// Start is called before the first frame update
void Start()
{
myRigid = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update(){
Move();
}
private void Move()
{
float _moveDirX = input.GetAxisRaw("Horizontal");
float _moveDirZ = input.GetAxisRaw("Vertical");
Vector3 _moveHorizontal = transfrom.right * _moveDirX;
Vector3 _moveVertical = transfrom.forward * _moveDirZ;
Vector3 _velocity = (_moveHorizontal + _moveVertical).normalized * walkSpeed;
myRigid.MovePosition(transfrom.position + _velocity * Time.deltaTime);
}
}