# How to make this camera movement smoother without removing the limitations

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;
}
}
``````

What do you mean by smooth?
Im not sure exactly how to help you, maybe if you can give me a bit more information about your problem.

You might want to look into Vector3.SmoothDamp.

At the end of your script, where you simply set transform.localRotation, remove both

``````     transform.localRotation = Quaternion.Euler(angles);

transform.localEulerAngles = angles;
``````

And change it to something like:

``````transform.localEulerAngles = Vector3.SmoothDamp(transform.localEulerAngles, angles, ref currentVelocity, smoothTime);
``````

Don’t forget to add these to the top of your script:

``````float currentVelocity;
float smoothTime = 0.2f; //(Or however fast you want the smoothing to be.)
``````