Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CreateBox

Create a Polygon as a four-sided box.
Read time 1 minuteLast updated 7 days ago

Definition

  • Type: Method
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule

CreateBox(Vector2, float, bool)

Create a Polygon as a four-sided box.
public static PolygonGeometry CreateBox(Vector2 size, float radius = 0, bool inscribe = false)

Parameters

The full size of the box.

radius

The radius to use.

inscribe

When true, the specified size will be inclusive of the specified radius. If true, a warning will be produced if the radius is greater-than or equal-to twice the specified size.

Returns

Type

Description

PolygonGeometryThe created geometry.

CreateBox(Vector2, float, PhysicsTransform, bool)

Create a Polygon as a four-sided box.
public static PolygonGeometry CreateBox(Vector2 size, float radius, PhysicsTransform transform, bool inscribe = false)

Parameters

The full size of the box.

radius

The radius to use.

The transform used to specify where the geometry is positioned.

inscribe

When true, the specified size will be inclusive of the specified radius. If true, a warning will be produced if the radius is greater-than or equal-to twice the specified size.

Returns

Type

Description

PolygonGeometryThe created geometry.