프로퍼티 | 타입 | 설명 | |
---|---|---|---|
_edgeNormals | Vector2[] | ||
isUnrotated | bool | ||
points | Vector2[] |
프로퍼티 | 타입 | 설명 | |
---|---|---|---|
_originalPoints | Vector2[] |
메소드 | 설명 | |
---|---|---|
Polygon ( Vector2 points ) : System |
constructs a Polygon from points. points should be specified in clockwise fashion without duplicating the first/last point and they should be centered around 0,0.
|
|
Polygon ( int vertCount, float radius ) : System |
creates a symmetrical polygon based on the radius and vertCount passed in
|
|
buildEdgeNormals ( ) : void |
builds the Polygon edge normals. These are lazily created and updated only by the edgeNormals getter
|
|
buildSymmetricalPolygon ( int vertCount, float radius ) : Vector2[] |
builds a symmetrical polygon (hexagon, octogon, n-gon) and returns the points
|
|
collidesWithLine ( Vector2 start, Vector2 end, RaycastHit &hit ) : bool | ||
collidesWithShape ( |
||
containsPoint ( Vector2 point ) : bool |
essentially what the algorithm is doing is shooting a ray from point out. If it intersects an odd number of polygon sides we know it is inside the polygon.
|
|
findPolygonCenter ( Vector2 points ) : Vector2 |
finds the center of the Polygon. Note that this will be accurate for regular polygons. Irregular polygons have no center.
|
|
getClosestPointOnPolygonToPoint ( Vector2 points, Vector2 point, float &distanceSquared, Vector2 &edgeNormal ) : Vector2 |
iterates all the edges of the polygon and gets the closest point on any edge to point. Returns via out the squared distance to the closest point and the normal of the edge it is on. point should be in the space of the Polygon (point - poly.position)
|
|
getFarthestPointInDirection ( Vector2 points, Vector2 direction ) : Vector2 | ||
overlaps ( |
||
pointCollidesWithShape ( Vector2 point, CollisionResult &result ) : bool | ||
recalculateCenterAndEdgeNormals ( ) : void |
recalculates the Polygon centers. This must be called if the points are changed!
|
|
recenterPolygonVerts ( Vector2 points ) : void |
recenters the points of the polygon
|
메소드 | 설명 | |
---|---|---|
Polygon ( Vector2 points, bool isBox ) : System | ||
recalculateBounds ( Collider collider ) : void |
public Polygon ( int vertCount, float radius ) : System | ||
vertCount | int | Vert count. |
radius | float | Radius. |
리턴 | System |
public static buildSymmetricalPolygon ( int vertCount, float radius ) : Vector2[] | ||
vertCount | int | Vert count. |
radius | float | Radius. |
리턴 | Vector2[] |
public collidesWithLine ( Vector2 start, Vector2 end, RaycastHit &hit ) : bool | ||
start | Vector2 | |
end | Vector2 | |
hit | RaycastHit | |
리턴 | bool |
public collidesWithShape ( |
||
other | ||
result | CollisionResult | |
리턴 | bool |
public static findPolygonCenter ( Vector2 points ) : Vector2 | ||
points | Vector2 | Points. |
리턴 | Vector2 |
public static getClosestPointOnPolygonToPoint ( Vector2 points, Vector2 point, float &distanceSquared, Vector2 &edgeNormal ) : Vector2 | ||
points | Vector2 | |
point | Vector2 | Point. |
distanceSquared | float | Distance squared. |
edgeNormal | Vector2 | Edge normal. |
리턴 | Vector2 |
public static getFarthestPointInDirection ( Vector2 points, Vector2 direction ) : Vector2 | ||
points | Vector2 | |
direction | Vector2 | |
리턴 | Vector2 |
public pointCollidesWithShape ( Vector2 point, CollisionResult &result ) : bool | ||
point | Vector2 | |
result | CollisionResult | |
리턴 | bool |
public static recenterPolygonVerts ( Vector2 points ) : void | ||
points | Vector2 | Points. |
리턴 | void |