+1 vote


Like the Binding of Isaac, I created a room out of sprites to place obstacles and enemies. (using arrays)

The Binding of Isaac used arrays, which I don't know for now, and numbered them lower and farther away from the player's position.

As a result, enemies dodge a number of obstacles and move to the location closest to the player. However, it is very inefficient to give each enemy such an arrangement and calculate the path for every delta.

Do you know Navigation2D dynamically allocating obstacles and avoiding them?
or Is there a way to avoid using A-Star?

It's hard to get a clear idea with all of them using Tilemap.

Thanks for the poor English too.

Godot version 3.3.2
in Engine by (79 points)

1 Answer

+2 votes
Best answer

a way to use Navigation2D without tilemaps is with the NavigationPolygonInstance node, is a polygon shape and inside you place the coordinates of the obstacles.

by (452 points)
selected by

Thank you for answer!

If I use polygons to individually collide with obstacles in the editor and then instance them, will the navigation point to the player avoiding the obstacles?

with the NavigationPolygonInstance node you create a polygon shape and holes in it the holes become the obstacles, to place instances as obstacles for pathfinding i would place the obstacles before the scene loads inside the holes, but to change the obstacles at runtime dynamically haven't done that, i leave example images of the NavigationPolygonInstance nodes:

Thank you, I will make big rectangle (room, in editor)and subtract collision shape of obstacle in runtime.

Hows the performance? Can you tell me

Unfortunately, I use astar2d now in my project. sorry for you that I can't inform.

No problem man

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.