How do I get my enemies to look in the direction they are moving in? (2D characters in 3D world)

I currently have my enemy AI able to patrol areas using a BTTask in my BehaviorTree but they are always facing whatever default direction they are facing when placed in the world/spawned, so if they are placed in the world looking to the right they will always face the right regardless of if they are moving to the right or left.

I’ve set the destination of GetRandomReachablePointInRadius as a variable that I can use in my BP_Enemy but I’m not sure how or where to use it (or if I should even be using it there?). I’m still quite new and so I’ve been following tutorials online but many aren’t suited well for the 2D characters in 3D world. My best guess would be to somehow make the sprite flip 180degrees or remain the same based on the patrol destination location being to the left or right of the enemy’s current position but I’m unsure of how to exactly do that.

I am using the PaperZD plugin if that makes a difference. Any help would be appreciated and here are some screenshots.



Found a temporary fix for this issue by adding some things to a function I have in the AIC blueprint that I hadn’t previously shown a screenshot of. Basically when my AI has a valid attack target it sets focal point to the player and when it is not valid it sets focal point to the saved destination variable.

Only issue now is that when the player enters aggro range of an enemy and then leaves the nav mesh, the enemy goes back to patrolling but is always facing the player because it still has a valid attack target and hasn’t been reset/removed.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.