0 votes

I only want to know how will I check if a given coordinate lies on a polygon2d or not

Godot version v3.2.3-stable_win64
in Engine by (884 points)
edited by

Do you need an intersection with its segment line?

Only I want to check if the point is on Polygon2D or not

Are you there?

1 Answer

0 votes
Best answer

There's a function for that in the GDScript Geometry class:

bool is_point_in_polygon ( Vector2 point, PoolVector2Array polygon )

Returns true if point is inside polygon or if it's located exactly on polygon's boundary, otherwise returns false.


by (1,742 points)
selected by
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.