How to navigate around non-tilemap nodes?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Pwyred

I’m trying to implement navigation in a top-down 2D game where the “Player” node will travel to wherever the user clicks on the map. I have a Navigation2D > TileMap setup that defines the navigate-able areas, and everything is working so far using the $Navigation2D.get_simple_path() method.

My next step was adding an “Enemy” node, but realized that the “Player” wasn’t able to navigate around the enemy, or any other collide-able node that wasn’t part of the tilemap.

Is there anyway to extend Navigation2D’s functionality to non-tilemap nodes? Any advice is appreciated!

:bust_in_silhouette: Reply From: Inces

It is not possible to utilize Navigation for moving objects. Depending of how fluid You want this movement You could use Astar for dynamic pathfinding or raycasts for collision avoidance ( shift movement left or right depending on which raycast is colliding with enemy )

Good to know, thanks!

Pwyred | 2021-11-16 00:23