Can somebody look at my rotation and see why its throwing a null reference please
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FPS_Player_controller : MonoBehaviour
{
public float rotationSpeed = 1f;
//sesttings for cinemachine
public GameObject cinemachineTarget;
public float topClamp = 90f;
public float bottomClamp = -90f;
private float _cinemachineTargetPitch;
private float _rotationVelocity;
private Main_Controls _input;
private const float _threshold = 0.01f;
private void start()
{
_input = GetComponent<Main_Controls>();
}
private void LateUpdate()
{
CameraRotation();
}
private void CameraRotation()
{
if (_input.look.sqrMagnitude > _threshold)
{
_cinemachineTargetPitch += _input.look.y * rotationSpeed * Time.deltaTime;
_rotationVelocity = _input.look.x * rotationSpeed * Time.deltaTime;
_cinemachineTargetPitch = ClampAngle(_cinemachineTargetPitch, bottomClamp, topClamp);
cinemachineTarget.transform.localRotation = Quaternion.Euler(_cinemachineTargetPitch, 0f, 0f);
transform.Rotate(Vector3.up * _rotationVelocity);
}
}
private static float ClampAngle(float angle, float minAngle, float maxAngle)
{
if (angle < -360f)
{
angle += 360f;
}
if (angle > 360f)
{
angle -= 360f;
}
return Mathf.Clamp(angle, minAngle, maxAngle);
}
}