How to Smoothly Rotate AI Characters in Unreal Engine 4

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).

Selecting the main actor

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

Showing the actor info

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

Disabling the yaw controller rotation
This prevents the AI from snapping towards the controller direction.

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

Selecting the character movement component

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

Searching in the details panel for Rotation settings

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

Setting the Z value to 180 and ticking orient rotation to movement

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

Instant rotation of AI

Smooth AI Rotation

Smooth rotation of AI

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.

5 Comments

  1. … 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

Leave a Reply

Your email address will not be published.


*