Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NavigationRegion nodes should warn you that they won't work until baked #9070

Closed
TDuffinNTU opened this issue Feb 11, 2024 · 3 comments
Closed

Comments

@TDuffinNTU
Copy link

Describe the project you are working on

a tower defence-like game where certain units can move freely within a 2d region

Describe the problem or limitation you are having in your project

I spent over an hour debugging why my navigation agents didn't move, only to discover the "bake navigation polygon" button that I didn't notice before.

This isn't helped by the fact that there are no warnings that you're trying to navigate with an unbaked nav. region. However, it WILL throw an error if navigation is attempted before said node is synchronized (even if it has no data to sync!).

Symptoms for an unbaked nav mesh are hard to diagnose if you've not used the feature before, especially with the minimal documentation available.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A warning icon like used for character body nodes that lack collision should be shown when a navigation region hasn't been baked yet. This would help signpost users to the "bake navigation" button and avoid searching for ages and following contradictory documentation suggestion the real issue is not deferring until the 2nd physics frame.

Better yet, if Godot detects you've called get_next_path_position whilst you have no baked navigation regions in the scene tree, an error/assertion should be thrown.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

  1. Warning icon, shown when a NavigationRegion node has no baked mesh. Similar to CharacterBody2D without collision:
    image

  2. Throw an exception when get_next_path_position is called and Godot cannot find a baked navigation mesh to use.

If this enhancement will not be used often, can it be worked around with a few lines of script?

Better documentation for how to use the node within the editor would be good. Right now there's not much useful info on setting up navigation "step by step"

Is there a reason why this should be core and not an add-on in the asset library?

It's a core Godot node.

@smix8
Copy link

smix8 commented Feb 11, 2024

Better documentation for how to use the node within the editor would be good.

There is a section for the NavigationRegion2D navigation mesh baking here https://docs.godotengine.org/en/latest/tutorials/navigation/navigation_using_navigationmeshes.html#baking-a-navigation-mesh-with-a-navigationregion

@smix8
Copy link

smix8 commented Mar 27, 2024

With PR godotengine/godot#87504 NavigationRegion2D now auto-bakes by default after a delay.

@TDuffinNTU
Copy link
Author

Appreciate the work on this. For some reason I never could find that linked documentation when learning about NavMesh2D but I'm thankful this is being improved! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants