system
1
|
|
|
|
Attention |
Topic was automatically imported from the old Question2Answer platform. |
|
Asked By |
Help me please |
Hi!
I only want to know how will I check if a given coordinate lies on a polygon2d or not
Do you need an intersection with its segment line?
sash-rc | 2021-08-15 14:29
No
Only I want to check if the point is on Polygon2D
or not
Help me please | 2021-08-15 15:34
Are you there?
Help me please | 2021-08-18 05:58
system
2
|
|
|
|
Reply From: |
Thomas Karcher |
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.
https://docs.godotengine.org/de/stable/classes/class_geometry.html#class-geometry-method-is-point-in-polygon