Bitmap.opaque_to_polygons ignored some part of the bitmap, is this a bug or intended?

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

Hi,

I’m trying to generate the navigation polygons for the new navigation system, the map is generated in code and a bitmap is created to show which tiles are walkable or not (each pixel in the bitmap represents a tile in the map).

When I use Bitmap.opaque_to_polygons(), seems it will miss some part of the bitmap.

You may see the area that I marked in red on the image below.
https://i.ibb.co/hdz3wzN/polygon1.png

I don’t know if this is a intended effect or a bug from the function.

If this is intended, what would be the correct way to get what I need?

Thank you!

I don’t know about Godot 4, but Godot 3 has a few issues with this: BitMap `opaque_to_polygons()` polygon generation problem · Issue #31675 · godotengine/godot · GitHub

SteveSmith | 2023-01-25 11:18

I looked into the link, I feel it’s not quite the same as the problem as I’m having now.

After playing around a bit more, it seems once the function has found one polygon, it will not detect if there is any ‘hole’ inside it.

Seanfy | 2023-01-26 08:56