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.