How do I prevent an AI character from rotating while moving?

I have an AI controlled pawn in a level and I want it to move to a specific location. I’m using “AI Move To” to accomplish this. However, the pawn will always rotate to face the destination that it is moving to. How do I stop the pawn from rotating while it is moving?

Hi

if you disable “Use controller rotation yaw” but then it won’t turn at all and will move side ways to the destination

I’ve got another function that makes the enemy rotate to face the player. What I want to happen is for the enemy to keep facing the player while moving to a destination. AI Move To on its own makes the enemy constantly switch between looking at the player and looking at the new destination, so it jitters about and looks awkward.

Is this a helicopter-like pawn that can strafe while facing the player? Or, is this a humanoid that you would like their head to turn towards the player?

In the case of the floating pawn, you could use a MoveToLocation; it has a strafe option.

Are you using a form of SetFocus with the player as the target?

Hi guys, I have the same problem as BenDaykin. Actually the controller always take the rotation give by the MoveTo.
Can we prevent the controller from having rotations automatically?

first of all the ai shouldnt just change its position while chasing. the enemies speed should be good enough so that it can catch up to the player. also you can go to project setting and search for Strafe in The AI Portion.

Hi!

  • To avoid having the AI Character look instantly at the controller’s rotation, deselect “User Controller Rotation Yaw” on the Character

  • If you want the AI to look at the rotation, but interpolated and nicely, select “Use Controller Desired Rotation” in the CharacterMovementComponent and set the Rotation Rate accordingly.

  • If you want your AI to strafe (look at the player or another target while moving sideways) you have to use the SetFocus function of the AI Controller. If no Focus is set, the AI Controller will look at it’s Move Target. If a Focus is set, it will look at the Focus always. Warning: There is a “SetDefaultFocus” Service for BTs from Unreal, but for me it just doesn’t work. I’m using a Custom BTTask to set or Clear the Controller Focus.

5 Likes