Explore the properties you can use to configure a Physics Pose component in a 2D Physics Core object. For more information, refer to Add physics to a GameObject with 2D Physics Core.
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.
| Property | Description |
|---|---|
| Simulation Source | Sets the simulation world the object belongs to. The properties of the world affect the object’s movement. The options are:
|
| Simulation World | Attaches the object to a different simulation world than the default world. Drag a Physics Simulation World asset from the Project window to this property, or select the picker (⊙). This property is available only if you set Simulation Source to Simulation World. |
| Make Asset | Creates a Physics Simulation World asset for you to save, then assigns it to the Simulation World property. This property is available only if you set Simulation Source to Simulation World. |
| Property | Description |
|---|---|
| Definition Asset | Sets an asset that sets the values of the properties in this section. By default, this property is empty, and Unity stores the values inside the component. To set a definition asset, drag a Physics Pose Definition asset from the Project window to this property, or select the picker (⊙). For more information, refer to Configure 2D Physics Core scenes with definitions. |
| Body Type | Sets how the object behaves in the physics simulation. The options are:
|
| Body Constraints | Places restrictions on the movement and rotation of the object. The options are:
|
| Transform Write Mode | Sets the method Unity uses to copy the position of the physics object to the Transform component on the GameObject. The options are:
|
| Linear Velocity | Sets the initial velocity of the object in meters per second. The options are:
|
| Angular Velocity | Sets the initial rotational velocity of the object in degrees per second. The default is 0. |
| Linear Damping | Sets how quickly the linear velocity decreases, to simulate drag, air resistance, or friction. Low values produce a slower decay rate, so that the object moves faster for longer, like a heavy object. High values produce a faster decay rate, so that the object slows down over a short amount of time, like a lightweight object. The default is 0. |
| Angular Damping | Sets how quickly the angular velocity decreases, to simulate drag, air resistance, or friction. The default is 0. |
| Gravity Scale | Scales the gravity applied to the object. Use a positive value to apply gravity in the same direction, a negative value to reverse gravity, or 0 to apply no gravity. The default is 1, which means gravity isn’t scaled up or down. |
| Sleep Threshold | Sets the speed below which Unity temporarily removes the object from physics calculations to save processor time. The value is in meters per second. The default is 0.05. |
| Collision Threshold | Sets the distance an object must travel in one frame to trigger Unity using continuous collision detection, as a proportion of the size of all the pose’s shapes. Continuous collision detection prevents fast-moving objects from passing through other objects, but might reduce performance significantly. Use a lower value to stop more objects passing through other objects. The default is 0.5. Use a value of 0 to enable continuous collision detection at all times. |
| Fast Collisions Allowed | Enables more frequent collision detection, to avoid the object passing through other objects if it moves very fast. Enabling this setting can reduce performance. For more information, refer to Configure collisions between 2D Physics Core objects. |
| Fast Rotation Allowed | Removes the limit on how fast a physics object rotates. The limit avoids forces becoming too large and objects passing through each other incorrectly. Enabling this property is recommended only for circular objects. |
| Contact Recycling Allowed | Reuses the points where two objects collide if the objects move only slightly, instead of recalculating the points every frame. Disable this property to make sure incorrect collisions don’t occur after the objects move apart. Disabling the property might reduce performance. |
| Sleeping Allowed | Removes the object from physics calculations when it’s not moving or colliding, to save processor time. The recommended best practice is to leave this property enabled. |
| Awake | Sets the object as awake rather than in the sleep state. |
| Enabled | Removes the object from the physics simulation, but keeps the object and its handles alive. Disabling this property also removes any areas or constraints attached to the object from the physics simulation. |
| World Drawing | Draws the object when Unity draws the debug visualization of the world. For more information, refer to Visualize and edit 2D Physics Core scenes. |
| Mass Override | Sets which properties Unity overrides with the values you set Mass Configuration to. The options are:
|
| Mass Configuration | Sets the mass, center of mass, and rotational inertia of the object. Unity uses the values only if you set Mass Override to the corresponding property. The properties are:
|
| Property | Description |
|---|---|
| Callback Source | Sets the callback method the object calls when it moves or makes contact. The options are:
|
| Callback Target | Sets the object that receives physics callbacks. This property is available only if you set Callback Source to Pose or Bodies. |
The properties in this section set the specific method this object calls or the parameter it sets, and control the behavior of the On Body Update (BodyUpdateEvent) method of the component. This section is available only if you set Callback Source to Events.
For more information, refer to Inspector-configurable custom events.
Use the properties in this section to add your own data to the component, and read it using the U2D.Physics API. For more information, refer to Add custom data to a 2D Physics Core object.
| Property | Description |
|---|---|
| Object | Sets a custom object. Drag any object from the Hierarchy or Project windows to this property, or select the picker (⊙). |
| Physics Mask | Sets a custom set of enabled and disabled layers. For more information, refer to Configure collisions between 2D Physics Core objects. |
| Float | Sets a custom floating-point number. |
| Int | Sets a custom integer. |
| Int 64 | Sets a custom 64-bit integer. |
| Vector 3 Int | Sets a custom 3D vector of integers. |
| Bool | Sets a custom Boolean value. |
This section displays information about the physics object. You can’t directly edit the properties in this section.
| Property | Description |
|---|---|
| Valid | The state of the object. True means the object is in the simulation. |
| World | The index number of the world the object belongs to. The default is 0, which is the default world. |
| Index | The index number of the object in the world. |
| Generation | The number of times Unity has used the same Index for different objects. |
| Property | Description |
|---|---|
| Mass | The mass of the object in kilograms. |
| Center Of Mass | The center of mass of the object in local space. |
| Rotational Inertia | The rotational inertia of the object in kilograms per square meter. |
This section is visible only if you set Callback Source to a value other than Off.
| Property | Description |
|---|---|
| Body Update | The number of times Unity sends a callback message to a valid receiving object. |
| Property | Description |
|---|---|
| Awake | Whether the object is awake or asleep. |
| Shape Count | The number of shapes attached to this component. |
| Joint Count | The number of joints attached to this component. |
| Position | The position of the object in world space. |
| Rotation | The rotation of the object in world space, in degrees. |
| Linear Velocity | The linear velocity of the object in meters per second. |
| Angular Velocity | The angular velocity of the object in degrees per second. |