Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


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

The vertices to use.

radius

The radius to use.

Returns

Type

Description

PolygonGeometryThe 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.

radius

The radius to use.

The transform used to specify where the geometry is positioned.

Returns

Type

Description

PolygonGeometryThe 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.

radius

The radius to use.

transform

The transform used to specify where the geometry is positioned.

Returns

Type

Description

PolygonGeometryThe created geometry.

Create(ConvexHull, float)

Create a Polygon from the specified convex hull.
public static PolygonGeometry Create(ref PolygonGeometry.ConvexHull convexHull, float radius)

Parameters

convexHull

The convex hull to create the polygon from.

radius

The radius to use.

Returns

Type

Description

PolygonGeometryThe created geometry.