void Start()
{
player.GetComponent();
Cursor.lockState = CursorLockMode.Locked;
}
void Update()
{
//camera Rotation
float CamHori = Input.GetAxis("Mouse X");
transform.Rotate(Vector3.up * sensitivity * CamHori);
}
void FixedUpdate()
{
//movement
float horizontal = Input.GetAxisRaw("Horizontal");
float vertical = Input.GetAxisRaw("Vertical");
Vector3 movement = player.velocity;
movement.x = horizontal * speed;
movement.z = vertical * speed;
player.velocity = movement;
}
}