PolygonCollider2D
Collider for 2D physics representing an arbitrary polygon defined by its vertices.
Read time 10 minutesLast updated 4 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.Physics2DModule
- Inherits from: Collider2D
public sealed class PolygonCollider2D : Collider2D
Remarks
Properties
Property | Description |
|---|---|
| autoTiling | Determines whether the PolygonCollider2D's shape is automatically updated based on a SpriteRenderer's tiling properties. |
| pathCount | The number of paths in the polygon. |
| points | Corner points that define the collider's shape in local space. |
| useDelaunayMesh | When the value is true, the Collider uses an additional Delaunay triangulation step to produce the Collider mesh. When the value is false, this additional step does not occur. |
Methods
Method | Description |
|---|---|
| CreateFromSprite | Create polygon shapes using the selected sprite. |
| CreatePrimitive | Creates as regular primitive polygon with the specified number of sides. |
| GetPath | Gets a path from the Collider by its index. |
| GetTotalPointCount | Return the total number of points in the polygon in all paths. |
| SetPath | Define a path by its constituent points. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |