Yet another third person orbiting camera script

using UnityEngine;

public class CameraControls : MonoBehaviour 
{
	static Transform cached_camera;
	static Transform cached_player;
	static Quaternion home_rotation;
	static float distance = 10;
	
	void Start()
	{
		cached_player = GameObject.FindGameObjectWithTag("Player");	
        cached_camera = transform;
		cached_camera.rotation = home_rotation = Quaternion.Euler(30.0f, 0, 0);
	}
	
	void LateUpdate() 
	{
		if (Input.GetMouseButton(0) || Input.GetMouseButton(1)) 
		{	
			cached_camera.rotation = Quaternion.Euler(cached_camera.localEulerAngles + new Vector3(-Input.GetAxis("Mouse Y") * 3, Input.GetAxis("Mouse X") * 5, 0));
			
			if(Input.GetMouseButton(1))
			{
				home_rotation = cached_camera.rotation;
				cached_player.rotation = Quaternion.Euler(0, cached_camera.localEulerAngles.y, 0);
			}
		}
		else
			cached_camera.rotation = Quaternion.Slerp(cached_camera.rotation, home_rotation, 0.05f);

		distance = Mathf.Clamp(distance - Input.GetAxis("Mouse ScrollWheel") * 5, 5, 15);
		cached_camera.position = cached_camera.rotation * Vector3.back * distance + cached_player.position + Vector3.up;
	}
}

It’s terribly messy but I just wanted it fast so if anyone wants it. Should just be able to drop it on the camera, assuming there’s one object with a player tag. It orbits with left and orbits + rotate player with right.

not that bad, ive seen alot worse…