AI Controller disregards character deceleration

Hi there,
For navmesh using AI pawns, I can’t seem to be able to get them to obey CharacterMovementComponent deceleration and breaking parameters. Movement obeys acceleration parameters (slowly speeds up), but comes to an abrupt stop at movement goal.

I’m using a move to location request on the owning ai controller.

I’ve tested with various combinations, with normal AIController class, DetourCrowdController class, with physical interactions on/off, with deceleration/breaking overrides on/off.

I’ve created a sample project that demonstrates the problem. It’s based off of TopDown sample.

To reproduce, open project, play in editor, and click on floor to issue move to request. Observe that AI obeys acceleration but not deceleration parameters.

Here is the download for the project;
https://s3.amazonaws.com/clapfootpublic/AI_Deceleration_Test.zip

Thanks for your help.

Clapfoot, have you found a solution yet? I’ve got the same problem on my current project.

Hi Abeccu,
From digging into code, I found that if you call SetStopMovementOnFinish(false) on the PathFollowingComponent, it will make the actor use acceleration to slow down, BUT, only after it has already reached it’s goal. So it will overshoot the goal.

I only partially tested this, so hopefully it will work for you.

Ok I remember now, I think this works for the simple path following component, but not the crowd following component.

Thanks for the reply! Did you by any chance find a way to force this via blueprint?

Unfortunately, no, I don’t think you can call that function from blueprints.

Having the same issue here :confused: Pretty odd that this is the default behavior…?

And this is how it is done:

UFUNCTION(BlueprintCallable, Category = "BPLibrary")
		static void SetStopMovementOnFinish(UPathFollowingComponent *PathFollowingComponent, bool bEnable);


void BPFunctionLibrary::SetStopMovementOnFinish(UPathFollowingComponent *PathFollowingComponent, bool bEnable)
{
	if(PathFollowingComponent)
		PathFollowingComponent->SetStopMovementOnFinish(bEnable);
}

I was able to simulate deceleration using a bit of math and adjusting the playing max walk speed as the player approached the target. I know this isn’t a true fix but it got the job done. I can dig up a screenshot if it’d be helpful.

According to Epic, it is fixed in 4.15

Nevetherless, if you can share a screenshot for the community, it will be awesome!

Sorry for the delayed response. I’ll post a screenshot tonight.

Set bUseAccelerationForPaths to True will resolve this problem.

1 Like

In UE5.0 this seems to be broken when using the DetourCrowd AIController.
It works perfectly well with the default AIController but not with the detour one.

1 Like

This is the solution that worked for me. Annoying that it’s a protected variable and can only edit in BP (as far as I can tell) but nice to have non-jittery AI movement finally. Many thanks!

yes, I just tried this and I can confirm that setting the CharacterMovementComponent property ‘Use Acceleration For Paths’ to true, and tweaking the braking decelration for walking/swimming etc. will make the characters decelrate closer to the end of a path… the lower the braking deceleration value, the earlier the character will start decelerating. If the value is high, the character will decelrate very quickly and stop abruptly, so be sure to play with this setting