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

NavigationPolygon: Unable to make polygons from outlines when a vertex is used twice #38204

Closed
T4g1 opened this issue Apr 25, 2020 · 5 comments · Fixed by #68486
Closed

NavigationPolygon: Unable to make polygons from outlines when a vertex is used twice #38204

T4g1 opened this issue Apr 25, 2020 · 5 comments · Fixed by #68486

Comments

@T4g1
Copy link

T4g1 commented Apr 25, 2020

Godot version: 3.2

OS/device including version: Windows 10

Issue description:
When using NavigationPolygon, it's impossible to create polygons from outlines when a vertex is used twice

Steps to reproduce:

  1. Create a script
  2. Instantiate a NavigationPolyon
  3. Add two outlines sharing one vertex
  4. Call make_polygons_from_outlines()

Minimal reproduction project:
gd-bug.zip

@razcore-rad
Copy link
Contributor

razcore-rad commented Aug 22, 2020

I don't know if this is related, but I got a problem when adding the following red polys as outlines:

image

Whereas these would work just fine

image

image

image

I'm attaching below the project that adds the white polygon as an outline, then subtracts the blue poly from the red one and adds it as an outline then by calling make_polygons_from_outlines() we get the error

E 0:00:00.296   make_polygons_from_outlines: NavigationPolygon: Convex partition failed!
  <C++ Source>  scene/2d/navigation_polygon.cpp:262 @ make_polygons_from_outlines()
  <Stack Trace> DBG.gd:10 @ _ready()

image

dbg.zip

@jh62
Copy link

jh62 commented Oct 9, 2021

Yes. If you try to manually create a polygon, you can visualize this problem too with the message: NavigationPolygon: Convex partition failed!

kNOnUJyt04

It's pretty annoying. I need to disable the navigation in certain areas based on the tiles used and I can't.

@dweremeichik
Copy link

dweremeichik commented Feb 28, 2022

From my testing, this does not seem to be limited to a vertex being used twice (unless there is a bit of rounding goin on under the hood). In my tests, when outlines overlap (point inside another polygon) or intersect (like two rectangles forming a plush shape), you will also receive this error. It seems likely that make_polygons_from_outlines() does not know how to handle/merge overlapping polygons.

Edit: adding engine version for reference:
v3.4.2.stable.official [45eaa2d]

@ivakam
Copy link

ivakam commented Jul 15, 2022

Issue seems to persist as of version 4.0 alpha 11. Very annoying when trying to do custom navpolys based on tilemap colliders :/

@smix8
Copy link
Contributor

smix8 commented Jul 16, 2022

2D navigation polygons create Navigationmesh resources from outlines specifically and outlines cannot cross or overlap, ever.

What ppl are trying to do here with the navigation polygon draw tool wouldn't work even if the tool would allow it. A single navigation polygon does not merge individual polygons so all those navigation cells would be disconnected. Instead, ppl should use navigationregions / navigationpolygon nodes (for each) cell as those are merged by the NavigationServer.

EDIT

Multiple NavigationPolygonInstances only merge their navpolygons in 3.5+ if the polygon edges are within Navigation2DServer edge_connection_margin.

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

Successfully merging a pull request may close this issue.

8 participants