0 votes

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))
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.

in Engine by (16 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.