Summary
I am using NavigateTo with an agent as the target, to make an NPC follow the player.
If the return value of NavigateTo is Interrupted, I stop the follow behavior and teleport the NPC near the player using TeleportTo.
However, in this case, the NPC unexpectedly returns to the position it was in before the teleport, even though no new NavigateTo call has been made.
This issue still occurs even if I insert a Sleep(1.0) after detecting Interrupted and before teleporting the NPC.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
AI
Steps to Reproduce
- Make an NPC follow a player using
NavigateTo
. - Check the navigation result.
- If the result is not
Reached
, especially if it isInterrupted
, teleport the NPC usingTeleportTo
.
Code snippet:
NavTarget := MakeNavigationTarget(PlayerAgent)
NavigationResult := PetNavigatable.NavigateTo(NavTarget, ?ReachRadius := 110.0, ?AllowPartialPath := false)
if (NavigationResult = navigation_result.Reached):
Print("Reached")
else if:
NavigationResult = navigation_result.PartiallyReached or
NavigationResult = navigation_result.Blocked or
NavigationResult = navigation_result.Unreachable or
NavigationResult = navigation_result.Interrupted
then:
if (NPCCharacter.TeleportTo[Position, Rotation])
Expected Result
Since NavigateTo
has finished (with a non-success result), the NPC should remain in place after being teleported.
Observed Result
The NPC begins moving toward the position it was in before the teleport, even though NavigateTo
was not called again.
Platform(s)
PC (Windows 11)
UEFN (Unreal Editor for Fortnite)
Video
Additional Notes
- This issue occurs roughly 50% of the time.
- It rarely happens on flat, empty terrain.
- It is more likely to happen when there are props or complex level geometry near the teleport location.
- This suggests that the NavMesh or movement state may be disrupted by overlapping props or collision.