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.
Create a physics object
To create a physics object, follow these steps:
- Select a GameObject, then in the window, select Add Component.Inspector
?
- Select Physics 2D (Core) > Physics Pose.
- Select Add Component again.
- Select an Area component, for example Physics Area Circle.
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.