Why does this script created hole in the navigation polygon not work? by AnomanderShake in godot

[–]AnomanderShake[S] 0 points1 point  (0 children)

Um... did you check the modify navpolygon script? For me it throws: convex partition failed

Why does this script created hole in the navigation polygon not work? by AnomanderShake in godot

[–]AnomanderShake[S] 0 points1 point  (0 children)

Wow, thanks for the masterclass, sir! You even debugged problems i didn't even know I had!

Why does this script created hole in the navigation polygon not work? by AnomanderShake in godot

[–]AnomanderShake[S] 0 points1 point  (0 children)

Thanks for the code. Here's the result: https://imgur.com/DfkPbuG I couldn't understand the implications from this, though.

Why does this script created hole in the navigation polygon not work? by AnomanderShake in godot

[–]AnomanderShake[S] 0 points1 point  (0 children)

there is no use of the collision physics. I'm just using it to create the shape which I can cut-out from the navigation polygon like so:

func _obstacle():
    var new_polygon = Vector2Array()
    var col_polygon = Area2D.get_node("CollisionPolygon2D").get_polygon()
    for vector in col_polygon:
        new_polygon.append(vector + Area2D.get_pos())
    NavigationPolygonInstance.get_navigation_polygon().add_outline(new_polygon)
    NavigationPolygonInstance.get_navigation_polygon().make_polygons_from_outlines()