So I’ve been following Plai’s tutorial on youtube on a rigidbody FPS Controller and it does not follow the mouse
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerCamera : MonoBehaviour
{
[SerializeField] private float sensX;
[SerializeField] private float sensY;
Camera cam;
float mouseX;
float mouseY;
float multiplier = 0.01f;
float xRotation;
float yRotation;
private void Start()
{
cam = GetComponentInChildren<Camera>();
}
private void Update()
{
MyInput();
cam.transform.localRotation = Quaternion.Euler(xRotation, 0, 0);
transform.rotation = Quaternion.Euler(0, yRotation, 0);
}
void MyInput()
{
mouseX = Input.GetAxisRaw("Mouse X");
mouseY = Input.GetAxisRaw("Mouse Y");
yRotation += mouseX * sensX * multiplier;
xRotation += mouseY * sensY * multiplier;
xRotation = Mathf.Clamp(xRotation, -90f, 90f);
}
}
