# Unity 2D rotation not smooth?

There's something wrong with the rotation of the gun. He's doing -1 on the X-axis. No problem on the other rotation X 1 axis. I suggest you watch a video.

No problem in the right part. The problem is on the left side. The turns on the right side are smooth. Turning angles on the left side are not smooth.

**Watch the problem:** https://youtu.be/kuBWoF5r2Bs

C# Code:

```
void FixedUpdate()
{
//rotation
Vector3 mousePos = Input.mousePosition;
Vector3 objectPos = cam.WorldToScreenPoint(transform.position);
mousePos.x = mousePos.x - objectPos.x;
mousePos.y = mousePos.y - objectPos.y;
float angle = Mathf.Atan2(mousePos.y, mousePos.x) * Mathf.Rad2Deg;
//transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle)); //Rotating!
if (Input.GetButtonDown("Fire1"))
{
Instantiate(projectile, shotPoint.position, transform.rotation);
}
if (angle > 0f && angle < 100f || angle < 0f && angle > -90f)
{
if (direction == false)
{
direction = true;
Dondurs();
}
}
if (angle > 100f && angle < 180f || angle < -90f && angle > -180f)
{
if (direction == true)
{
direction = false;
Dondurs();
}
}
if (direction == true)
{
angle = Mathf.Clamp(angle, -24, 24);
Quaternion target = Quaternion.Euler(new Vector3(0, 0, angle));
transform.rotation = target;
}
if (direction == false)
{
angle = Mathf.Clamp(angle, 24, -24);
Quaternion target = Quaternion.Euler(new Vector3(0, 0, angle));
transform.rotation = target;
}
}
public void Dondurs()
{
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
}
```

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.