|Attention||Topic was automatically imported from the old Question2Answer platform.|
I use Navigation2D to navigate in a tilemap generated at runtime. However, the wayfinding does not work properly the object the wayfinding is applied to never runs the direct way and often gets stuck on collision tiles. I use simple single tiles with a navigation rectangle on top.
That’s the code I use to follow the trail:
if start_moving_to_destination: if path.size() >= 1: var velocity = (path - position).normalized() * speed var applied_velocity = move_and_slide(velocity) if position.distance_to(path) < 2: path.remove(0) else: start_moving_to_destination = false