Having Trouble Turning AI in place

I’m trying to make the AI turn to face it’s Destination Location before moving forward but for some reason it keeps getting stuck in a looping turning animation with the result of a Find Look At Rotation not making much sense.

If anyone can point me to some examples that would be great. I’m not using the Controller to turn the character, it’s set to turn based on movement so using the controller’s turn variable or rotation isn’t going to help.

You just need to call Set Focus. SetFocus | Unreal Engine Documentation

If i do that, how will I drive the turning animations? Right now I have the turning animations in a blendspace which is driven by a float value for direction. I could make each turn direction a separate state driven by a boolean for is turning right or is turning left but how would i know what direction i’m turning in with that node? Or even if it’s done turning?

I believe you can play with DesiredRotation and ControlRotation. You can draw debug line and see how they deviate from each other when you turn. I’m not sure if in your case you want to keep that behavior - it will keep the character facing that direction. BTW, this is how you do strafing.

But, if you want to look once at destination and then walk to it, but do not keep focus, then Set Focus is no help. Probably it is better to find an angle to rotate to (angle between my forward and where my destination is - dot product) and rotate my character to that angle.

1 Like

You may be “adding local rotation” instead of “setting rotation” Adding local repeatedly would keep spinning