
The default behaviour for Unreal Engine 4 AI characters is to instantly snap towards the direction they are facing.
AI smooth rotation in Unreal Engine 4 is simple and requires very little change to your existing AI characters.
In this guide we will be making your AI character smoothly turn when moving between locations.
If you don’t have a simple AI character read our guide here.
Smoothing the Turning
Firstly, click the top section of the character in the top left side of the editor window.
In our case this is AITestCharacter(self).

This will now show the character and actor information in the details section on the right.

In the Pawn section, Untick the “Use Controller Rotation Yaw”

Next, click the “CharacterMovement (Inherited)” section to show the character movement settings on the right.

In the top right search box type “rotation” to show the related options.

In the Character Movement Rotation Settings tab, change the Z Rotation Rate value to 180 and tick the “Orient Rotation to Movement” box.

Demonstration
In this demo we show AI smooth rotation in Unreal Engine 4 that use the Troll mesh and animations from the Troll Pack PBR asset pack found on the Unreal Marketplace by InfinityPBR.
Instant AI Rotation

Smooth AI Rotation

Conclusion
Your AI characters now rotation smoothly and can be customised based on the agility of your game characters!
Let us know in the comments or contact us directly if you have any problems or want to request new Unreal Engine 4 topics.
Further Reading:
To enable your AI characters to roam large open worlds, check out our guide on enabling dynamic nav mesh generation.
To read more about AI in Unreal Engine, click here to read the official documentation on Behaviour Trees.
… dude, thank you very very much !!! …. this was a pain on my side and I always fix it with some code on AI task/service ….. now things are easy !!! …. you are magic, thank you …. : ) ,,
– Katax
Thank you so much!!
Thank you ! Very smooth rotation indeed.
“In the Pawn section, Untick the “Use Controller Rotation Yaw””
AMAZING!! LOVE THIS!!
THANKS SO SO SO SO MUCH!
Appreciate it. I’ve had this page bookmarked for months and referred to it when I couldn’t remember what do to.