NavMoverComponent ConsumeNavMovementData returning true when called more than once per frame

Hello,

we are currently experimenting with Mover and have run into what we think is a bug in the NavMoverComponent. Our player pawn is set up to move either with direct input from the player but can sometimes also move via nav movement. To handle this we first ask the NavMoverComponent if there is any input and if there is not, we use the players input, which looks something like this:

FVector MovementDirectionalInput, MovementVelocityInput;
if (NavMoverComponent->ConsumeNavMovementData(MovementDirectionalInput, MovementVelocityInput))
{
   return MovementVelocityInput.IsNearlyZero() ? MovementDirectionalInput : MovementVelocityInput.GetSafeNormal();
}

const FRotator& ControlRotation = GetControlRotation();
const FVector FinalDirectionIntent = ControlRotation.RotateVector(MoverInputState.MovementInput.GetClampedToMaxSize(1.0f)).GetSafeNormal();
return FinalDirectionIntent;

This does work, as long as ConsumeNavMovementData is only called once per frame. If there is no nav input the function starts returning true when it is called more than once per frame, even though it should still be returning false for this frame. Looking at the function we are not quite sure what the idea was. It seems that checking if there was a new request needs to be cached whenever bHasFrameAdvanced is true and when it’s false it should be used instead of checking the frame counters.

For now we just worked around it by ignoring the input if both Direction and Velocity are zero, but it would be great to know if we are just not understanding the idea right now.

Thanks!

[Attachment Removed]

Steps to Reproduce

  • Create a pawn that has a Mover and NavMoverComponent
  • Create a produce input function that calls ConsumeNavMovementData and if the result is true uses that input data, else use player input data
  • Set the NPP ticking policy to fixed
  • Set your frame rate to something lower than the fixed NPP rate
  • Notice that ConsumeNavMovementData returns false for the first call in the frame, but then true for every consecutive call in the same frame
    [Attachment Removed]

I do not believe this is by design. I am passing this over to my colleague who has been working on the NavMoverComponent as he may even have some changes in development for this that I am not aware of.

-James

[Attachment Removed]

Hello,

Yes this is certainly a bug in the NavMoverComponent. Thanks for bringing it to our attention! I’ll make a ticket and take a look at it soon. In the meantime you can track the status of it here: UE-392894.

Thanks,

Nate

[Attachment Removed]