AI either doesn't animate, or doesn't move

I’m having some odd behavior, and maybe because I’m choosing to use a different Paragon asset for my character, but I’ll see if I can elaborate.

At first, my AI compadres would move towards me but they would float. Their animations wouldn’t play like the Player Controller’s does.

Some Googling led me to this answer:

Basic ai characters dont seem to use acceleration for nav movement for … reasons haha no idea why. The paragon assets movements are based on acceleration…

So the fix for that was easy enough. Going into the Character Movement component in our ShooterCharacter BP and toggling on “Use Acceleration for Paths”.

Now the animations play properly when the AI follows me, but now I have another problem.

If I spawn in LOS of the AI, it will follow me and perform all its expected logic I’ve written.

If I don’t spawn in LOS of the AI, when I later move into LOS, it will update the focus because its view will follow me, but it won’t move at all. In fact, in this situation, neither MoveToActor() nor MoveToLocation() will cause the AI to move, but both will update focus successfully.

Is there something else I need to account for in my code when using “Use Acceleration for Paths”?

// --------------------------------------------------------------
void AShooterAIController::BeginPlay()

	// Get reference to player in world.
	Player = UGameplayStatics::GetPlayerPawn(GetWorld(), 0);
	PatrolPosition = K2_GetActorLocation();

// --------------------------------------------------------------
void AShooterAIController::Tick(float DeltaSeconds)

	bool SeesPlayer = LineOfSightTo(Player, FVector::ZeroVector, true);

	if (SeesPlayer) {
		SeenPlayer = true;
		Elapsed = 0;
		// Have this AI focus on the player.
		// Move towards the player.
		MoveToActor(Player, FollowDistance);
		// Keep this up-to-date so we can move towards this once we lose LOS.
		LastKnownPosition = Player->GetActorLocation();
		UE_LOG(LogTemp, Warning, TEXT("Moving towards player."));
	else if (SeenPlayer) {
		Elapsed += DeltaSeconds;

		// Follow beyond losing LOS so we appear to investigate a bit beyond the last seen corner.
		if (Elapsed <= LastKnownPredictionLimit) {
			UE_LOG(LogTemp, Warning, TEXT("Moving to last known location."));
			LastKnownPosition = Player->GetActorLocation();

		// Constantly move towards last known position until we lose interest.

		if (Elapsed > TimeToLoseInterest) {
			UE_LOG(LogTemp, Warning, TEXT("Heading home."));


#pragma once

#include "CoreMinimal.h"
#include "AIController.h"
#include "ShooterAIController.generated.h"

// --------------------------------------------------------------
class SHOOTER_API AShooterAIController : public AAIController

	virtual void Tick(float DeltaSeconds) override;

	virtual void BeginPlay() override;

	APawn* Player;
	float FollowDistance;
	float TimeToLoseInterest = 5;
	float Elapsed;
	float LastKnownPredictionLimit = 1;

	bool SeenPlayer = false;

	FVector PatrolPosition;
	FVector LastKnownPosition;

Just to note, this problem does not happen when I toggle “Use Acceleration for Paths” off and use identical logic, just that then the animations won’t play due to the anim graph logic being based on IsAccelerating (which I do like after looking at how it works).

Okay after some experimenting with nearby booleans on the Movement component, I found a fix. Toggling on “Use Fixed Braking Distance for Paths” fixed all the issues. Now the AI does exactly what I expect.

I don’t understand why that fixed this problem though. I’m completely confused.

Based on a 2 minute read of that all:

I presume it was too close and had already began to brake… but it also wasn’t fast enough so that meant it just stopped? Using fixed braking distance + an override of 0 meant that it doesn’t start braking until at the destination?

I set FollowDistance to 250 in the editor so the AI gets pretty close. I’ll post a video of all 3 situations so you can see and maybe gain some insight, because I’m still confused.

Here’s Rider showing the value is set to 250 in Unreal, and also lets me open the blueprint through Rider so I can confirm that value too.

Here’s a comparison of each setting and the results. I also log each state as it changes just to be sure.

What does it look like with a lower value? A quick look at the calculation it would appear the braking distance would be about 90.

Privacy & Terms