Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


Add physics to a GameObject with 2D Physics Core

Create a 2D physics body, then attach shapes to the body.
Read time 1 minuteLast updated 14 days ago

To add physics to a GameObject, add a Physics Pose component to make the GameObject part of the 2D physics simulation, and one or more Physics Area components, which give it a shape.
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.

Create a physics object

To create a physics object, follow these steps:
  1. Select a GameObject, then in the
    Inspector

    ?

    window, select Add Component.
  2. Select Physics 2D (Core) > Physics Pose.
  3. Select Add Component again.
  4. Select an Area component, for example Physics Area Circle.
Note
By default, a physics object is static and isn't affected by physics. To make it dynamic, in the Physics Pose component, set
Body Type

?

to Dynamic.
To move the GameObject, use the Transform component of the GameObject. Changing an object's position doesn't change its center of mass. Unity calculates the center of mass from the mass of the shapes attached to the object.
For the full list of Physics Area components and the shapes they create, refer to Physics Pose and Physics Area components.

Configure physics properties

To configure physics properties, such as shape, mass, and collision behavior, adjust the properties in the Inspector window. For more information, refer to Physics Pose component reference and the component reference page for the Area component you're using, such as Physics Area Circle component reference.
To share the same properties across multiple GameObjects, create a definition asset. For more information, refer to Share properties across multiple 2D Physics Core components.

Additional resources