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.
Explore the properties you can use to configure a Physics Simulation Definition asset in the Unity Editor. A Physics Simulation Definition asset wraps a PhysicsWorldDefinition object, which sets the properties of a physics world, such as gravity. For more information, refer to Create multiple simulation worlds with 2D Physics Core.
| Property | Description |
|---|---|
| Gravity | Sets the gravity Unity applies to all the bodies in the world. The default is –9.81 on the y-axis, which simulates Earth’s gravity. |
| Simulation Type | Sets when the physics simulation runs. The options are:
|
| Simulation Sub Steps | Sets the number of times the physics simulation runs per step to calculate stable values. If your world includes a complex set of joints, increasing this value can improve performance. The default is 4. |
| Simulation Workers | Sets the number of threads the simulation uses. The default is 64. The number of threads might be limited by the number of available CPU cores on the device. |
| Transform Write Mode | Sets the method Unity uses to copy the position of the physics body to the Transform component on the GameObject. The options are:
|
| Transform Tween Mode | Interpolates or extrapolates the positions of physics bodies between simulation updates, and writes their positions to Transform components. The options are:
|
| Transform Plane | Determines which 3D space to convert the final 2D positions to. The options are:
|
| Sync Interpolation | Avoids interpolated positions becoming out of sync between the physics body and the Transform component. Enabling this property adds an extra pass to write the interpolated position, which can reduce performance. This property only affects bodies that have Transform Write Mode set to Interpolate. |
| Sleeping Allowed | Removes bodies from physics calculations when they move at a slower speed than their Sleep Threshold value, to save processor time. When a sleeping body receives a collision or force, Unity wakes up the body and continues to include it in physics calculations. The recommended best practice is to leave this property enabled. |
| Continuous Allowed | Enables continuous collision detection to prevent moving bodies tunneling through static bodies. For more information, refer to Configure collisions between 2D Physics Core objects. |
| Event Grouping Allowed | Triggers contact and trigger events only when the first or last shape in a group makes contact with another shape. Enabling this property reduces the number of contact events, but might reduce performance. |
| Contact Filter Callbacks | Enables physics objects optionally calling the IContactFilterCallback method of a shape if it makes contact with another shape, so you can run your own code that determines whether the shapes should collide. This property applies only to dynamic objects. Disabling this property can improve performance. |
| Pre Solve Callbacks | Enables physics objects optionally calling the OnPreSolve2D method of a dynamic object before Unity calculates the collision response, so you can run your own code. This property applies only to dynamic objects. Disabling this property can improve performance. |
| Auto Body Update Callbacks | Enables physics objects optionally calling the IBodyUpdateCallback method of a body if it’s updated, so you can run your own code. |
| Auto Joint Threshold Callbacks | Enables physics objects optionally calling the OnJointThreshold2D method of a joint if it exceeds its Force Threshold or Torque Threshold value. |
| Bounce Threshold | Sets the collision velocity in meters per second that causes objects to bounce. Avoid very small values, otherwise Unity can’t put bodies to sleep to reduce CPU time. |
| Contact Hit Event Threshold | Sets the relative speed in meters per second that two shapes must reach to generate a contact hit event. |
| Contact Frequency | Sets the stiffness of how objects respond to contact in Hertz (cycles per second). A lower value makes contact softer and spongier. A higher value makes contact harder and more rigid. |
| Contact Damping | Sets how quickly objects absorb the shock of a collision. A lower value makes objects less likely to settle after a collision. A higher value makes objects settle more quickly. The default value is 10. |
| Contact Speed | Sets the speed Unity can push overlapping objects apart to separate them, in meters per second. The default value is 3. |
| Contact Recycle Distance | Sets the distance in meters that two shapes can move relative to each other before Unity recalculates their contact point instead of reusing it. Set this property to 0 to disable reusing contact points. Reusing contact points improves stability and performance, but Unity skips some updates, such as friction, until the contact is no longer recycled. |
| Maximum Linear Speed | Sets the maximum speed of objects in the world, in meters per second. |
| Draw Options | Determines which bodies, shapes, joints, and collisions Unity draws. The options are:
|
| Draw Fill Options | Defines which parts of shapes Unity draws. The options are:
|
| Draw Contact Type | Sets which point of a contact Unity draws when Draw Options includes contact points. The options are:
|
| Draw Filter | Disables Unity drawing specific types of bodies and shapes. |
| Draw Target | Sets which Editor views Unity draws the world into. The options are:
|
| Draw Thickness | Sets the thickness of the lines Unity draws in pixels. |
| Draw Fill Alpha | Sets the transparency of the color Unity uses to fill shapes. Accepted values range from 0 to 1. This property has no effect if you disable Outline in Draw Fill Options. |
| Draw Point Scale | Sets the size of the points that Unity draws. |
| Draw Normal Scale | Sets the size of the contact normals for joints that Unity draws. |
| Draw Force Scale | Sets the size of the contact forces for joints that Unity draws. |
| Draw Order | Sets the relative order Unity draws this world. Unity draws worlds with a lower value first, so worlds with a higher value draw on top. |
| Draw Colors | Sets the different colors Unity uses to draw each element. |
These properties only have an effect if you set Transform Plane to Custom.
| Property | Description |
|---|---|
| Translate | Sets the position of the plane in 3D space. |
| Rotate | Sets the rotation of the plane in 3D space. |
| Scale | Scales the plane. |
The properties in this section affect the amount of internal memory Unity uses to create a world.
If you leave these properties at zero, Unity uses its own minimum defaults.
| Property | Description |
|---|---|
| Static Shape Count | Sets the number of static shapes you expect to create in the world. |
| Dynamic Shape Count | Sets the number of dynamic and kinematic shapes you expect to create in the world. |
| Static Body Count | Sets the number of static bodies you expect to create in the world. |
| Dynamic Body Count | Sets the number of dynamic and kinematic bodies you expect to create in the world. |
| Contact Count | Sets the number of contacts you expect in the world. |