Hello,
I would like this camera movement code to be smoother, and I have no idea how to implement that. If you could post a solution then ill be very thankful…
Thanks
public class LimitedCamera : MonoBehaviour
{
public float LimitAngleX = 10f;
public float LimitAngleY = 10f;
private float AngleX;
private float AngleY;
public void Update()
{
var angles = transform.localEulerAngles;
var xAxis = Input.GetAxis("Mouse X");
var yAxis = Input.GetAxis("Mouse Y");
AngleX = Mathf.Clamp(AngleX - yAxis, -LimitAngleX, LimitAngleY);
AngleY = Mathf.Clamp(AngleY + xAxis, -LimitAngleY, LimitAngleY);
angles.x = AngleX;
angles.y = AngleY;
transform.localRotation = Quaternion.Euler(angles);
transform.localEulerAngles = angles;
}
}