How to achieve smooth rotation using Navmesh? (actor keeps snapping towards direction)

I currently have AI enemy characters setup to follow the player, however their rotation seems to keep snapping towards the player and it looks awful and broken. I’ve tried turning on/off enable strafing, have tried desired rotation/orient rotation to movement, with the rotation rate set to 5, but it still consistently snaps towards the rotation instead of smoothly turning. Is there an option elsewhere outside the character I’ve missed?

I’d greatly appreciate a response as the way it rotates now looks like a rushed and broken system and I wouldn’t want to release a game like this.

Hi SwiftIllusion,

Go to your AI Pawn and under Components > CharacterMovement > Enable “Orient Rotation to Movement”

Then under Defaults > Pawn > Disable “Use Controller Rotation Yaw” & Under Character Movement > set “Yaw” to a value you like (for example 180).

I hope that helps.

Thanks, TJ

4 Likes

Thank you very much :D, the “Use Controller Rotation Yaw” was the option I had missed to turn off that fixed it :)!

This doesnt work at all. The “Orient rotation to movement” and so fort do absolutely nothing to the rotation smoothness. Is something changed in latest versions of UE???

enabling Orient rotation to movement only not going to work
u must go to your AI Pawn Class default, and do as he said :
“Then under Defaults > Pawn > Disable “Use Controller Rotation Yaw” & Under Character Movement > set “Yaw” to a value you like (for example 180).”

Or “RInterp To” node where the target is the players position and the node includes time and rotation speed.

From my experience, this does achieve slow rotation of the meshes inside moving actor towards the final rotation, but the direction of the actor’s root movement (the forward vector) is still changing instantaneously.

Say you’ve got 3 target points (or a baseball field for that matter) in NavMesh and you want the actor to run from one to the next. My question is, is it possible to achieve a trajectory similar to a real baseball player, who would run in a smooth trajectory, even if it’s a bit longer, and not running to 1st base, turning in an instant and run towards the second and so forth?

Thanks!

2 Likes

I had the same problem , but when I tried it on two different computers with one being the host and the other the client , it worked perfect , everything was smooth. But if I tried to launch 2 clients on the same computer , the rotation wasnt smooth. :slight_smile:

Thanks TJ worked amazingly.

Just wanted to say thanks to SwiftIllusion, this was exactly what I was looking for!

Thanks a lot ! “Use Controller Rotation Yaw” was the option I had missed to turn off

Thanks for this, I messed with a bunch of rotation settings to get that working, but had missed the “Use Controller Rotation Yaw” under the pawn - definitely got the other settings working.

Check that your spring arm “Use Pawn Control Rotation” is also disabled.

I understand the “Orient Rotation to Movement” and “Use Controller Rotation Yaw” to smooth the rotation of the character. But I need something like mitjaprelovsek stated above about a trajectory turn.

100665-aipath
(Picture borrowed from another post)

I have a large creature that needs to take a large arcing movement when turning. It does not make sense to turn as they move to their destination. There is a sliding as they turn and walk that looks ugly.

I did find other posts but most say the same thing about the Orientation and Yaw. This just causes the ugly turn slide or the creature to move backwards/sideways with forward animations.

I know it can be done, I see it in games with bigger creatures (ARK).

This post was a big help.

There is a issue though where if the target is in the middle of their arc, they just run around in circles since they can not get to the target. How can this be calculated in?

Realistically, for a large creature that needs specific pathways, you would animate the turn using root motion so that the X/Y/Z are accurate but can always be adjusted at runtime (no guarantee your terrain is flat or spacious enough afterall).

Srill, its done via Animation as a starting point rather than some wierd code or calculation.
That’s the only way you’ll avoid foot sliding.

Its very similar to how turn in place would work, but turn in plqce is easier to implement as it doesnt really beed a full animation like you do for the arc movement.

Oh and the whole discussion above with checking this that and the other is a dud and was always a dud.
The only way to achieve good motion AI side is to specifically code the AI to use the correct motition.

Unless you want to somehow relay on the mess they made with the pose selection stuff that’s just come out. Stuff which epic claims is able to choose a best matching animation automatically after being trained on an animation set. At the moment, I can pretty much guarantee anyone that it’s publicity Bs rather than a working and functioning system…

You may check this, I made an asset that helps with this task. Asset Link