Version: Unity 7.0 Alpha (7000.0)
Language : English
Physics Pose and Physics Area components
Add physics to a sprite with 2D Physics Core

Add physics to a GameObject with 2D Physics Core

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

Physics Pose and Physics Area components
Add physics to a sprite with 2D Physics Core
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961