AI doesn't face correct direction while moving

I am trying to implement an AI that will walk to a location and shoot the player I specify in my behavior tree. However, when the AI spawns, the AI will go to the specified location facing the wrong direction.

My Behavior Tree (For testing purposes, I have disconnected the other tasks):

The AI in action:

I have tried so far:

  • Making a new AI with the same behavior tree
  • Rewritten the AI in c++
  • The answer in this post: AI movement rotation - AI - Epic Developer Community Forums. This works correctly. However I do not want to do this since I have another AI that orients itself correctly while moving to a location. Implementing this answer also freezes Rotate to face BB entry task on the problem AI
  • Checked to make sure the Blackboard is receiving the correct values

Check the character BP the capsule component is facing down the X axis and the default skeleton is facing down the Y. You need to rotate your character mesh in the blueprint to match the blue arrow on the collision capsule for the character.

1 Like

I have tried your suggestion, but the AI is still moonwalking as shown in the picture.

Can you take a screenshot of the AI BP to show the skeletal mesh rotation relative to the capsule?

Ok lets narrow down what else might be causing the problem. Create a new default minimum level. In the level scale up the floor to 5 and then drag in a NavMeshBounds and set it to 5000x5000x500 and center it’s location to 0,0,0. Drag in one of your AI characters but make sure it doesn’t use any controller other than the default engine AIController and open the level blueprint and make a simple AI Move To like this:

. If there is any code in the character event graph that might override the move to disconnect it temporarily. Now Simulate in Editor (Alt+S). Doing this should help narrow down where the issue might be, if the AI character moves around normally then there is logic somewhere that is telling it to move incorrectly, possibly in a BT task or in the character event graph. Let me know if the character moves correctly or if the problem persists and we can take another step towards finding the underlying issue.

Sorry I didn’t get to you sooner. I was busy.

As a followup to your request, I have replicated the parameters you have provided.The problem AI is selected in the gif:

looks like he is moving in his forward direction now.

lets give him a delay of 10 seconds after the first move to and then repeat the first set of nodes to get him to move a second time to make sure he is moving in his forward direction

Since he is moving in the direction he is supposed to here you should look at how you are getting him to move in the other level or in his BT

After trying the tests Black Phoenyx suggested, I managed to get the AI to roam again by replacing the controller I used for a new one. The old controller didn’t have move in its behavior tree so after updating to many versions of unreal, it didn’t work, hence the moving in the wrong orientation.