Note: This documentation is about writing C# scripts using the LowLevelPhysics2D API. 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 world in the Unity Editor, if you create a public PhysicsWorldDefinition object. For more information, refer to Create a world with the LowLevelPhysics2D API.
| 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 jointsA physics component allowing a dynamic connection between Rigidbody components, usually allowing some degree of movement such as a hinge. More info See in Glossary, 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 Plane | Determines which 3D space to convert the final 2D positions to. The options are:
|
| Transform Tweening | Interpolates or extrapolates the position of the physics body between simulation updates, and writes the position to the Transform componentA Transform component determines the Position, Rotation, and Scale of each object in the scene. Every GameObject has a Transform. More info See in Glossary. This property has no effect if you disable Transform Write Mode. For more information, refer to Move a GameObject. |
| 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 collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info See in Glossary 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 detectionAn automatic process performed by Unity which determines whether a moving GameObject with a Rigidbody and collider component has come into contact with any other colliders. More info See in Glossary to prevent moving bodies tunnelling through static bodies. For more information, refer to Configure collisions between LowLevelPhysics2D API objects. |
| 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. |
| Pre Solve Callbacks | Enables physics objects optionally calling the OnPreSolve2D method of a dynamic body before Unity calculates the collision response, so you can run your own code. |
| 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 Contact Callbacks | Enables physics objects optionally calling the OnContactBegin2D and OnContactEnd2D methods of a shape if it makes contact with another shape, so you can run your own code. For more information, refer to Detect collisions between LowLevelPhysics2D API objects
|
| Auto Trigger Callbacks | Enables physics objects optionally calling the OnTriggerBegin2D and OnTriggerEnd2D methods of a shape if it makes contact with another shape, so you can run your own code. For more information, refer to Detect collisions between LowLevelPhysics2D API objects. |
| 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. |
| 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 Thickness | Sets the thickness of the lines Unity draws in pixelsThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info See in Glossary. |
| 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 Impulse Scale | Sets the size of the contact impulses for joints that Unity draws. |
| Draw Capacity | Sets the initial number of objects Unity allocates memory to draw. If you set this to a higher value than the default of 0, Unity doesn’t resize the buffer when it draws more elements, which prevents Unity allocating memory that needs garbage collection. |
| Draw Colors | Sets the different colors Unity uses to draw each element. |