Delaunator-GDScript
Delaunator-GDScript copied to clipboard
For godot4 users: slice end is now exclusive
Godot4 array api has changed a lot, and the meaning of end param in slice method has changed, which is the inclusive index previously and now is the exclusive index, same as the original javascript lib.
In this case, line 295-296 should be
triangles = _triangles.slice(0, triangles_len)
halfedges = _halfedges.slice(0, triangles_len)
otherwise you will got a non-3-multiply length array .triangles, which is invild.
Thank you for the heads up! I haven't had time to try Godot 4.0.
FYI: I just updated my "ClickableMap" demo including the Delaunator script to work with Godot 4.0: https://github.com/t-karcher/ClickableMap
Feel free to copy the script from this project back here. (I don't want to open a pull request because you'll also have to update you the rest of the project to make it work, and the 4.0 version is not backward compatible with 3.x)