+1 vote

To move a point in curve2d in game use:
path.curve.set_point_position (2, get_local_mouse_position ())
With this function I move the point at index 2 of the curve with the mouse, but what I want to do, instead of moving point 2, is to move the point closest to the mouse.
This is the function:
get_closest_point (to_point: Vector2)
But this function returns a vector2 with the coordinates of the point. What I want is to return your index number in the array. What am I missing here, any ideas?

in Engine by (1,714 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 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 webmaster@godotengine.org with your username.