Fixed a problem where pathfinding didn't work after the character teleported by asking the navigation agent to generate a new path after teleportation.
func teleport(door: Door) -> void:
# ...
# Try repathing after teleporting
= target.global_position navigation_agent.target_position
I'm not really sure why it fails after
teleportation, but it makes sense that generally
speaking a new path needs to be generated after the
position of the character is changed. This might be
happening because the NavigationLink2D
s
are too far away from the teleportation zone, so the
navigation system doesn't realize that the
teleportation has happened and it doesn't check the
last waypoint in the navigation path as reached.