Create
Create a Polygon from the specified vertices. The number of vertices must be in the range 3 to PhysicsConstants.MaxPolygonVertices.
Read time 1 minuteLast updated 8 days ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
Create(ReadOnlySpan<Vector2>, float)
Create a Polygon from the specified vertices. The number of vertices must be in the range 3 to PhysicsConstants.MaxPolygonVertices.
public static PolygonGeometry Create(ReadOnlySpan<Vector2> vertices, float radius = 0)
Parameters
Returns
Type | Description |
|---|---|
| PolygonGeometry | The created geometry. |
Create(ReadOnlySpan<Vector2>, float, PhysicsTransform)
Create a Polygon from the specified vertices. The number of vertices must be in the range 3 to PhysicsConstants.MaxPolygonVertices.
public static PolygonGeometry Create(ReadOnlySpan<Vector2> vertices, float radius, PhysicsTransform transform)
Parameters
The vertices to use.
The radius to use.
The transform used to specify where the geometry is positioned.
Returns
Type | Description |
|---|---|
| PolygonGeometry | The created geometry. |
Create(ReadOnlySpan<Vector2>, float, Matrix4x4)
Create a Polygon from the specified vertices. The number of vertices must be in the range 3 to PhysicsConstants.MaxPolygonVertices.
public static PolygonGeometry Create(ReadOnlySpan<Vector2> vertices, float radius, Matrix4x4 transform)
Parameters
The vertices to use.
The radius to use.
The transform used to specify where the geometry is positioned.
Returns
Type | Description |
|---|---|
| PolygonGeometry | The created geometry. |
Create(ConvexHull, float)
Create a Polygon from the specified convex hull.
public static PolygonGeometry Create(ref PolygonGeometry.ConvexHull convexHull, float radius)
Parameters
Returns
Type | Description |
|---|---|
| PolygonGeometry | The created geometry. |