Build a shape out of vertices you place yourself, rather than a primitive shape such as a circle or capsule.
Note: This documentation is about using Pose, Area, and Constraint components. To use 2D physics in the Unity Editor using components like the Rigidbody 2D component, refer to 2D physics instead.
You can create one of the following:
To combine multiple shapes into one shape, refer to Merge 2D Physics Core shapes.
To create a path that acts as a one-sided barrier, follow these steps:
Select a GameObject in the Hierarchy window, or create an empty GameObject.
In the Inspector window select Add Component, then Physics 2D (Core) > Physics Pose.
Select Add Component again, then select Physics 2D (Core) > Physics Area Path.
By default, the path is a line formed from two vertices. If you don’t need more than two vertices, add a Physics Area Segment component instead.
Select Add Start Vertex or Add End Vertex to add a vertex to the path.
You can also add, move, and remove vertices directly in the Scene view. For more information, refer to Visualize and edit 2D Physics Core scenes.
To change which side of the path other objects collide with, set the Winding property to CW (clockwise) or CCW (counter-clockwise).
Unity automatically creates an invisible extension of your path at either end, to make sure collisions with the ends of the path are accurate. Unity displays these extensions in the Scene view as dotted lines.
For the full list of properties, refer to Physics Area Path component reference.
To create a single convex polygon, follow these steps:
You can edit the vertices in the Inspector window, or edit the polygon directly in the Scene view. For more information, refer to Visualize and edit 2D Physics Core scenes.
To round the corners of the polygon, set the Radius property to a value greater than 0.
For the full list of properties, refer to Physics Area Polygon component reference.
To create an outline or filled shape, follow these steps:
Select a GameObject in the Hierarchy window, or create an empty GameObject.
In the Inspector window select Add Component, then Physics 2D (Core) > Physics Pose.
Select Add Component again, then select Physics 2D (Core) > Physics Area Contour.
By default, the component contains one contour, the four vertices of a square.
Set Output to Segments for an outline shape, or Polygons for a filled shape.
To add another vertex to a contour, select Add Vertex.
You can edit the vertices in the Inspector window, or edit contour vertices directly in the Scene view. For more information, refer to Visualize and edit 2D Physics Core scenes.
To change which side of the path other objects collide with, set the Winding property to CW (clockwise) or CCW (counter-clockwise).
Select Add Contour to add another shape. For more information, refer to Merge 2D Physics Core shapes.
For the full list of properties, refer to Physics Area Contour component reference.