Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Flamiers |
I already know that i can use navpoly_add of Navigation2D, but how do I create a suitable NacigationPolygon?
I want something like this:
func get_simple_path(start : Vector2, end : Vector2, optimize : bool = true) :
var navigation_poly = NavigationPolygon.new()
var x = PoolVector2Array()
x.append(Vector2(0, 0))
x.append(Vector2(96, 0))
x.append(Vector2(96, 96))
x.append(Vector2(0, 96))
navigation_poly.add_outline(x)
navigation_poly.make_polygons_from_outlines()
self.navpoly_add(navigation_poly, Transform2D(0, start))
return .get_simple_path(start, end, optimize)
So I want to add a NavigationPolygon as a square with a size of 96x96 at the start position, but that does not seem to work. Unfortunately, as far as I know, you can not output already created NavigationPolygons from Navigation2D to find my mistake.