using System.Collections;
using System.Collections.Generic;
public class playerMovement : MonoBehaviour
[SerializeField] private float sensitivity = 5.0f;
[SerializeField] private float smoothing = 2.0f;
private Vector2 mouseRotation;
private bool isGrounded = false;
cam = this.transform.GetChild(0).GetComponent<Camera>(); ;
playerStats = GetComponent<playerStats>();
rb = GetComponent<Rigidbody>();
Cursor.lockState = CursorLockMode.Locked;
Vector2 mouseInputs = new Vector2(Input.GetAxisRaw("Mouse X"), Input.GetAxisRaw("Mouse Y"));
mouseInputs = Vector2.Scale(mouseInputs, new Vector2((sensitivity / 10) * smoothing, (sensitivity / 10) * smoothing));
smooth.x = Mathf.Lerp(smooth.x, mouseInputs.x, 1f / smoothing);
smooth.y = Mathf.Lerp(smooth.y, mouseInputs.y, 1f / smoothing);
cam.transform.localRotation = Quaternion.AngleAxis(Mathf.Clamp(-mouseRotation.y, -85.0f, 85.0f), Vector3.right);
transform.localRotation = Quaternion.AngleAxis(mouseRotation.x, transform.up);
straight = Input.GetAxis("Vertical") * playerStats.playerSpeed * Time.fixedDeltaTime;
side = Input.GetAxis("Horizontal") * playerStats.playerSpeed * Time.fixedDeltaTime;
transform.Translate(side, 0, straight);
if (Input.GetButtonDown("Menu"))
Cursor.lockState = CursorLockMode.None;
private void OnCollisionStay(Collision collision)