using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playerMovement : MonoBehaviour
{
[Header("movement")]
public float moveSpeed = 6f;
float horizontalMovement;
float verticalMovement;
Vector3 moveDirection;
Rigidbody rb;
private void start()
{
rb = GetComponent<Rigidbody>();
rb.freezeRotation = true;
}
private void update();
void MyInput()
{
horizontalMovement = Input.GetAxisRaw("Horizontal");
verticalMovement = Input.GetAxisRaw("vertical");
moveDirection = transform.forward * verticalMovement + transform.right * horizontalMovement;
}
private void FixedUpdate()
{
void MovePlayer();
}
void MovePlayer()
{
rb.AddForce(moveDirection.normalized * moveSpeed, ForceMode.Acceleration);
}