To merge multiple physics shapes into one shape, for example to create a car with a body and two wheels, use one of the following approaches:
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.
To create a merged shape from primitives, add a Physics Area Composite component and build up its layers.
Follow these steps:
Follow these steps:
To add every area attached to an existing Physics Pose component instead, select Add Pose. Unity references the Area components attached to the Physics Pose component, rather than copying them. The Physics Pose component goes into composite mode. Composite mode stops the Physics Pose component using its own shapes, so that Unity doesn’t simulate or draw the same shapes twice.
For the full list of properties, refer to Physics Area Composite component reference.
To merge custom shapes, use a contour group. For example, to create an arbitrary silhouette, a shape with a hole in it, or several disconnected pieces in one area.
Follow these steps:
After you select Add Geometry, set Geometry to Contour Group.
By default, a contour group contains one contour, the vertices for a single square.
To add another vertex to the contour, select Add Vertex.
Select Add Contour to add another shape.
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 control how each layer combines with the previous layers in an outline or filled shape, expand Composite in the layer section, then select a value for Operation.
The options are:
To set which side of the merged layer faces out, use the Winding property.