Polygon represents a polygon which can be used to create collisions masks for RuntimeObject.
The center of the polygon. This property is only valid after calling computeCenter, and remains valid until vertices are modified.
The edges of the polygon. This property is only valid after calling computeEdges, and remains valid until vertices are modified.
Build a new object to store collision test results.
Build a new object to store raycast test results.
The vertices of the polygon
Do a collision test between two polygons. Please note that polygons must convexes!
The first polygon
The second polygon
If true, then edges that are touching each other, without the polygons actually overlapping, won't be considered in collision.
A collision result.
collision property is equal to true if polygons are overlapping. Do NOT keep a reference to this.
Do a raycast test. Please note that the polygon must be convex!
You can read the result but do not keep a reference to it as it's a static object
reused between function calls. If you need to keep the results, use
For some theory, check Find the Intersection Point of Two Line Segments.
The polygon to test
The raycast start point X
The raycast start point Y
The raycast end point X
The raycast end point Y
A raycast result with the contact points and distances. Do NOT keep a reference to this.
Generated using TypeDoc