Rotate Camera around object on X and Y on mouse button

Hello, i want to create game simmilar to World of Tanks and in garage i need camera to rotate around tank. Can someone help me with this code?

using UnityEngine;
public class CameraOrbit : MonoBehaviour
{
	void Update()
	{
		if (Input.GetMouseButton(0))
		{
			transform.RotateAround(Vector3.zero,Vector3.up,Input.GetAxis("Mouse X")*100*Time.deltaTime);
			transform.RotateAround(Vector3.zero,transform.right,Input.GetAxis("Mouse Y")*100*Time.deltaTime);
		}
	}
}
1 Like