AI Path following corner smoothing

Hello, I’m currently implementing an NPC movement (together with MotionMatching locomotion) and testing possible corner smoothing while moving using the PathFollowingController.

I’ve noticed that PathFollowingController only follows points on the path and, in the end, adds a normalised movement input to the NavMovementInterface like so (MoveInput implementation in the code snippet).

Therefore, there doesn’t seem to be any information on a possible next point and additional information to apply corner smoothing based on the predicted path.

Is there such a system implemented/planned that would make turning corners smoother and more precise?

Currently, the agent tends to drift out of the corner until the velocity catches up and corrects the movement to aim at the next point. This might cause the agent to bounce into walls or miss potential doors behind the corner. The only thing I have found that fixes this drift is increasing Ground friction on the actor. This change, however, makes the turning too precise without any curving at all, and the agent follows the rigid path perfectly without any smoothing whatsoever.

`// MoveInput implementation
void UPathFollowingComponent::FollowPathSegment(float DeltaTime)
{
[…]
CurrentMoveInput = (CurrentTarget - CurrentLocation).GetSafeNormal();
NavMovementInterface->RequestPathMove(CurrentMoveInput); // <<
}

// Friction implementation
void UCharacterMovementComponent::CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration)
{
[…]
else if (!bZeroAcceleration)
{
// Friction affects our ability to change direction. This is only done for input acceleration, not path following.
const FVector AccelDir = Acceleration.GetSafeNormal();
const float VelSize = Velocity.Size();
Velocity = Velocity - (Velocity - AccelDir * VelSize) * FMath::Min(DeltaTime * Friction, 1.f); // <<
}
[…]
}`

I know we had some prototypes a while back for path smoothing for AI that was using a unicycle movement model. I do not believe it made it far from prototyping as other items were deemed more important for development at the time. The plugin is experimental, but available in the engine under the name NavCorridor. There are a few plugins that use it inside of the engine such as MassAI for NavMesh pathing and navigation.

I have also reached out to some others on the team who helped with The Witcher 4 demo from UnrealFest to see if anything was added to support this.

-James