# How do I avoid buggy rotation?

**URL:** <https://forums.unrealengine.com/t/how-do-i-avoid-buggy-rotation/482151>\
**Category:** Community & Industry Discussion\
**Tags:** rotator, rotation, unreal-engine, question\
**Created:** [April 19, 2021, 4:17pm UTC](https://forums.unrealengine.com/t/how-do-i-avoid-buggy-rotation/482151 "2021-04-19T16:17:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hallonsaft](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hallonsaft](https://forums.unrealengine.com/u/Hallonsaft)\
**Post date:** [April 19, 2021, 4:17pm UTC](https://forums.unrealengine.com/t/how-do-i-avoid-buggy-rotation/482151/1 "2021-04-19T16:17:32Z")

</div>

I’m making a line trace from the center of the camera towards the ground and rotating a turret towards that location.

It works fine until I point the camera at 90 degrees where the rotation proceeds to flip to -270 degrees and the rotation spasm out of control.

How can I avoid this?

 ![336390-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/6/3/163eece42ad4229bcf7a49d2e9426e3d1fd781b1.jpeg)

 ![336401-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/b/9/bb9313c41c1bfd15c54af73535dfdf3d868ce42e.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 19, 2021, 4:30pm UTC](https://forums.unrealengine.com/t/how-do-i-avoid-buggy-rotation/482151/2 "2021-04-19T16:30:15Z")

</div>

You basically have to never read the rotation from the turret. Just store the turret rotation in a variable at the start, and only add ( or subtract, same thing ) rotation to it using ‘AddLocalRotation’
