Description

In MassEntity-based crowds, when an agent transitions from Stand to Move and begins walking, the Avoidance trait parameters StartOfPathDuration and StartOfPathAvoidanceScale, which are meant to temporarily soften avoidance at the start of a path, have no effect. When agents start walking out of a dense cluster, full avoidance force is applied immediately, producing oscillation (agents jittering side to side) and momentary backward movement.

FMassMoveTargetFragment::CreateNewAction only updates CurrentAction and never writes PreviousAction. PreviousAction is declared in the header with an initializer of EMassMovementAction::Move, and a tree-wide search finds no assignment to it anywhere outside that initializer. It is not updated in CreateReplicatedAction either.

As a result, GetPreviousAction() always returns EMassMovementAction::Move.

The following branch in UMassMovingAvoidanceProcessor::Execute (MassAvoidanceProcessors.cpp) is therefore always false, leaving NearStartFade at its initial value of 1.0:

if (MoveTarget.GetPreviousAction() != EMassMovementAction::Move)
{
    NearStartFade = FMath::Min((CurrentTime - MoveTarget.GetCurrentActionStartTime()) / MovingAvoidanceParams.StartOfPathDuration, 1.);
}

The subsequent line:

const FVector::FReal NearStartScaling = FMath::Lerp<FVector::FReal>(MovingAvoidanceParams.StartOfPathAvoidanceScale, 1., NearStartFade);

then always evaluates to 1.0 (no scaling), so StartOfPathAvoidanceScale and StartOfPathDuration are effectively ignored.

Suggested Fix

Add PreviousAction = CurrentAction; in CreateNewAction before CurrentAction is overwritten:

void FMassMoveTargetFragment::CreateNewAction(const EMassMovementAction InAction, const UWorld& InWorld)
{
    ensureMsgf(InWorld.GetNetMode() != NM_Client, TEXT("..."));
    PreviousAction = CurrentAction;   // added
    CurrentAction = InAction;
    CurrentActionID++;
    // ...
}
Steps to Reproduce
  1. Set up a MassEntity-based crowd sample (e.g. CitySample MassCrowd, or a MassAI sample).
  2. Give the crowd agents an Avoidance trait and, in FMassMovingAvoidanceParameters, set StartOfPathAvoidanceScale to a small value (e.g. 0.1) and StartOfPathDuration to a larger value (e.g. 1.02.0 seconds).
  3. Have several agents Stand in a dense cluster, close enough that their avoidance radii overlap.
  4. Trigger a Move for the agents (via a MoveTo or equivalent), either all at once or individually, so they begin walking out of the cluster.
  5. Observe the agents' behavior at the moment they start walking.

Expected Result

Immediately after movement starts, avoidance force is reduced by StartOfPathAvoidanceScale and fades in to full avoidance over StartOfPathDuration. Walking out of a dense cluster is smooth.

Actual Result

Full avoidance force is applied the instant movement starts. Agents that were packed closely together are shoved apart abruptly by strong separation forces, producing oscillation (jittering side to side) and momentary reversal / backward movement. Changing StartOfPathAvoidanceScale / StartOfPathDuration to any value has no effect on the behavior.

However, even if you follow these steps, it can be difficult to confirm the issue if the agents do not start moving in a situation where they are overcrowded.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-388548 in the post.

0
Login to Vote

Unresolved
ComponentUE - Runtime - Character
Affects Versions5.75.8
CreatedJul 28, 2026
UpdatedJul 28, 2026
View Jira Issue