0 votes

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!

Godot version 3.3.2
in Engine by (17 points)

1 Answer

+1 vote
Best answer

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 )

by (7,449 points)
selected by

Good to know, thanks!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.