# Physics2D

> Global settings and helpers for 2D physics.

## Definition

* **Type:** Class
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.Physics2DModule

```csharp
public class Physics2D
```

## Static Fields

| Value                                                                                                       | Description                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [AllLayers](/engine/6000.0/script-reference/unityengine/physics2d/alllayers.md)                             | Layer mask constant that includes all layers.                                                                                                                                                  |
| [DefaultRaycastLayers](/engine/6000.0/script-reference/unityengine/physics2d/defaultraycastlayers.md)       | Layer mask constant that includes all layers participating in raycasts by default.                                                                                                             |
| [IgnoreRaycastLayer](/engine/6000.0/script-reference/unityengine/physics2d/ignoreraycastlayer.md)           | Layer mask constant for the default layer that ignores raycasts.                                                                                                                               |
| [MaxPolygonShapeVertices](/engine/6000.0/script-reference/unityengine/physics2d/maxpolygonshapevertices.md) | The maximum number of vertices allowed per primitive polygon shape type ([PhysicsShapeType2D.Polygon](/engine/6000.0/script-reference/unityengine/physicsshapetype2d/polygon.md)). (Read Only) |

## Static Properties

| Property                                                                                                    | Description                                                                                                                                                                                                    |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [angularSleepTolerance](/engine/6000.0/script-reference/unityengine/physics2d/angularsleeptolerance.md)     | A Rigidbody cannot sleep if its angular velocity is above this tolerance threshold.                                                                                                                            |
| [autoSyncTransforms](/engine/6000.0/script-reference/unityengine/physics2d/autosynctransforms.md)           | Set whether to automatically sync changes to the [Transform](/engine/6000.0/script-reference/unityengine/transform.md) component with the physics engine.                                                      |
| [baumgarteScale](/engine/6000.0/script-reference/unityengine/physics2d/baumgartescale.md)                   | The scale factor that controls how fast overlaps are resolved.                                                                                                                                                 |
| [baumgarteTOIScale](/engine/6000.0/script-reference/unityengine/physics2d/baumgartetoiscale.md)             | The scale factor that controls how fast TOI overlaps are resolved.                                                                                                                                             |
| [bounceThreshold](/engine/6000.0/script-reference/unityengine/physics2d/bouncethreshold.md)                 | Any collisions with a relative linear velocity below this threshold will be treated as inelastic so no bounce will occur.                                                                                      |
| [callbacksOnDisable](/engine/6000.0/script-reference/unityengine/physics2d/callbacksondisable.md)           | Use this to control whether or not the appropriate OnCollisionExit2D or OnTriggerExit2D callbacks should be called when a [Collider2D](/engine/6000.0/script-reference/unityengine/collider2d.md) is disabled. |
| [contactThreshold](/engine/6000.0/script-reference/unityengine/physics2d/contactthreshold.md)               | A threshold below which a contact is automatically disabled.                                                                                                                                                   |
| [defaultContactOffset](/engine/6000.0/script-reference/unityengine/physics2d/defaultcontactoffset.md)       | The default contact offset of the newly created Colliders.                                                                                                                                                     |
| [defaultPhysicsScene](/engine/6000.0/script-reference/unityengine/physics2d/defaultphysicsscene.md)         | The [PhysicsScene2D](/engine/6000.0/script-reference/unityengine/physicsscene2d.md) automatically created when Unity starts.                                                                                   |
| [gravity](/engine/6000.0/script-reference/unityengine/physics2d/gravity.md)                                 | Acceleration due to gravity.                                                                                                                                                                                   |
| [jobOptions](/engine/6000.0/script-reference/unityengine/physics2d/joboptions.md)                           | A set of options that control how physics operates when using the job system to multithread the physics simulation.                                                                                            |
| [linearSleepTolerance](/engine/6000.0/script-reference/unityengine/physics2d/linearsleeptolerance.md)       | A rigid-body cannot sleep if its linear velocity is above this tolerance.                                                                                                                                      |
| [maxAngularCorrection](/engine/6000.0/script-reference/unityengine/physics2d/maxangularcorrection.md)       | The maximum angular position correction used when solving constraints.  This helps to prevent overshoot.                                                                                                       |
| [maxLinearCorrection](/engine/6000.0/script-reference/unityengine/physics2d/maxlinearcorrection.md)         | The maximum linear position correction used when solving constraints.  This helps to prevent overshoot.                                                                                                        |
| [maxRotationSpeed](/engine/6000.0/script-reference/unityengine/physics2d/maxrotationspeed.md)               | The maximum angular speed of a rigid-body per physics update.  Increasing this can cause numerical problems.                                                                                                   |
| [maxSubStepCount](/engine/6000.0/script-reference/unityengine/physics2d/maxsubstepcount.md)                 | The maximum number of simulation sub-steps allowed per-frame when simulation sub-stepping is enabled.                                                                                                          |
| [maxTranslationSpeed](/engine/6000.0/script-reference/unityengine/physics2d/maxtranslationspeed.md)         | The maximum linear speed of a rigid-body per physics update.  Increasing this can cause numerical problems.                                                                                                    |
| [minSubStepFPS](/engine/6000.0/script-reference/unityengine/physics2d/minsubstepfps.md)                     | The minimum FPS allowed for a simulation step before sub-stepping will be used.                                                                                                                                |
| [positionIterations](/engine/6000.0/script-reference/unityengine/physics2d/positioniterations.md)           | The number of iterations of the physics solver when considering objects' positions.                                                                                                                            |
| [queriesHitTriggers](/engine/6000.0/script-reference/unityengine/physics2d/querieshittriggers.md)           | Do raycasts detect Colliders configured as triggers?                                                                                                                                                           |
| [queriesStartInColliders](/engine/6000.0/script-reference/unityengine/physics2d/queriesstartincolliders.md) | Set the raycasts or linecasts that start inside Colliders to detect or not detect those Colliders.                                                                                                             |
| [reuseCollisionCallbacks](/engine/6000.0/script-reference/unityengine/physics2d/reusecollisioncallbacks.md) | Determines whether the garbage collector should reuse only a single instance of a Collision2D type for all collision callbacks.                                                                                |
| [simulationLayers](/engine/6000.0/script-reference/unityengine/physics2d/simulationlayers.md)               | The [Rigidbody2D](/engine/6000.0/script-reference/unityengine/rigidbody2d.md) and [Collider2D](/engine/6000.0/script-reference/unityengine/collider2d.md) layers to simulate.                                  |
| [simulationMode](/engine/6000.0/script-reference/unityengine/physics2d/simulationmode.md)                   | Controls when Unity executes the 2D physics simulation.                                                                                                                                                        |
| [timeToSleep](/engine/6000.0/script-reference/unityengine/physics2d/timetosleep.md)                         | The time in seconds that a rigid-body must be still before it will go to sleep.                                                                                                                                |
| [useSubStepContacts](/engine/6000.0/script-reference/unityengine/physics2d/usesubstepcontacts.md)           | Whether to calculate contacts for all simulation sub-steps or only the first sub-step.                                                                                                                         |
| [useSubStepping](/engine/6000.0/script-reference/unityengine/physics2d/usesubstepping.md)                   | Whether to use simulation sub-stepping during a simulation step.                                                                                                                                               |
| [velocityIterations](/engine/6000.0/script-reference/unityengine/physics2d/velocityiterations.md)           | The number of iterations of the physics solver when considering objects' velocities.                                                                                                                           |

## Static Methods

| Method                                                                                                      | Description                                                                                                               |
| ----------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [BoxCast](/engine/6000.0/script-reference/unityengine/physics2d/boxcast.md)                                 | Casts a box against Colliders in the Scene, returning the first Collider to contact with it.                              |
| [BoxCastAll](/engine/6000.0/script-reference/unityengine/physics2d/boxcastall.md)                           | Casts a box against Colliders in the Scene, returning all Colliders that contact with it.                                 |
| [CapsuleCast](/engine/6000.0/script-reference/unityengine/physics2d/capsulecast.md)                         | Casts a capsule against Colliders in the Scene, returning the first Collider to contact with it.                          |
| [CapsuleCastAll](/engine/6000.0/script-reference/unityengine/physics2d/capsulecastall.md)                   | Casts a capsule against Colliders in the Scene, returning all Colliders that contact with it.                             |
| [CircleCast](/engine/6000.0/script-reference/unityengine/physics2d/circlecast.md)                           | Casts a circle against Colliders in the Scene, returning the first Collider to contact with it.                           |
| [CircleCastAll](/engine/6000.0/script-reference/unityengine/physics2d/circlecastall.md)                     | Casts a circle against Colliders in the Scene, returning all Colliders that contact with it.                              |
| [ClosestPoint](/engine/6000.0/script-reference/unityengine/physics2d/closestpoint.md)                       | Returns a point on the perimeter of the Collider that is closest to the specified position.                               |
| [Distance](/engine/6000.0/script-reference/unityengine/physics2d/distance.md)                               | Calculates the minimum distance between two Colliders.                                                                    |
| [GetContacts](/engine/6000.0/script-reference/unityengine/physics2d/getcontacts.md)                         | Retrieves all Colliders in contact with the Collider.                                                                     |
| [GetIgnoreCollision](/engine/6000.0/script-reference/unityengine/physics2d/getignorecollision.md)           | Checks whether the collision detection system will ignore all collisions/triggers between collider1 and collider2 or not. |
| [GetIgnoreLayerCollision](/engine/6000.0/script-reference/unityengine/physics2d/getignorelayercollision.md) | Checks whether collisions between the specified layers be ignored or not.                                                 |
| [GetLayerCollisionMask](/engine/6000.0/script-reference/unityengine/physics2d/getlayercollisionmask.md)     | Get the collision layer mask that indicates which layer(s) the specified layer can collide with.                          |
| [GetRayIntersection](/engine/6000.0/script-reference/unityengine/physics2d/getrayintersection.md)           | Cast a 3D ray against the 2D Colliders in the Scene.                                                                      |
| [GetRayIntersectionAll](/engine/6000.0/script-reference/unityengine/physics2d/getrayintersectionall.md)     | Cast a 3D ray against the 2D Colliders in the Scene.                                                                      |
| [IgnoreCollision](/engine/6000.0/script-reference/unityengine/physics2d/ignorecollision.md)                 | Makes the collision detection system ignore all collisions/triggers between collider1 and collider2.                      |
| [IgnoreLayerCollision](/engine/6000.0/script-reference/unityengine/physics2d/ignorelayercollision.md)       | Choose whether to detect or ignore collisions between a specified pair of layers.                                         |
| [IsTouching](/engine/6000.0/script-reference/unityengine/physics2d/istouching.md)                           | Checks whether the passed Colliders are in contact or not.                                                                |
| [IsTouchingLayers](/engine/6000.0/script-reference/unityengine/physics2d/istouchinglayers.md)               | Checks whether the Collider is touching any Colliders on the specified layerMask or not.                                  |
| [Linecast](/engine/6000.0/script-reference/unityengine/physics2d/linecast.md)                               | Casts a line segment against Colliders in the Scene.                                                                      |
| [LinecastAll](/engine/6000.0/script-reference/unityengine/physics2d/linecastall.md)                         | Casts a line against Colliders in the Scene.                                                                              |
| [OverlapArea](/engine/6000.0/script-reference/unityengine/physics2d/overlaparea.md)                         | Checks if a Collider falls within a rectangular area.                                                                     |
| [OverlapAreaAll](/engine/6000.0/script-reference/unityengine/physics2d/overlapareaall.md)                   | Get a list of all Colliders that fall within a rectangular area.                                                          |
| [OverlapBox](/engine/6000.0/script-reference/unityengine/physics2d/overlapbox.md)                           | Checks if a Collider falls within a box area.                                                                             |
| [OverlapBoxAll](/engine/6000.0/script-reference/unityengine/physics2d/overlapboxall.md)                     | Get a list of all Colliders that fall within a box area.                                                                  |
| [OverlapCapsule](/engine/6000.0/script-reference/unityengine/physics2d/overlapcapsule.md)                   | Checks if a Collider falls within a capsule area.                                                                         |
| [OverlapCapsuleAll](/engine/6000.0/script-reference/unityengine/physics2d/overlapcapsuleall.md)             | Get a list of all Colliders that fall within a capsule area.                                                              |
| [OverlapCircle](/engine/6000.0/script-reference/unityengine/physics2d/overlapcircle.md)                     | Checks if a Collider falls within a circular area.                                                                        |
| [OverlapCircleAll](/engine/6000.0/script-reference/unityengine/physics2d/overlapcircleall.md)               | Get a list of all Colliders that fall within a circular area.                                                             |
| [OverlapCollider](/engine/6000.0/script-reference/unityengine/physics2d/overlapcollider.md)                 | Gets a list of all Colliders that overlap the given Collider.                                                             |
| [OverlapPoint](/engine/6000.0/script-reference/unityengine/physics2d/overlappoint.md)                       | Checks if a Collider overlaps a point in space.                                                                           |
| [OverlapPointAll](/engine/6000.0/script-reference/unityengine/physics2d/overlappointall.md)                 | Get a list of all Colliders that overlap a point in space.                                                                |
| [Raycast](/engine/6000.0/script-reference/unityengine/physics2d/raycast.md)                                 | Casts a ray against Colliders in the Scene.                                                                               |
| [RaycastAll](/engine/6000.0/script-reference/unityengine/physics2d/raycastall.md)                           | Casts a ray against Colliders in the Scene, returning all Colliders that contact with it.                                 |
| [SetLayerCollisionMask](/engine/6000.0/script-reference/unityengine/physics2d/setlayercollisionmask.md)     | Set the collision layer mask that indicates which layer(s) the specified layer can collide with.                          |
| [Simulate](/engine/6000.0/script-reference/unityengine/physics2d/simulate.md)                               | Simulate physics in the default physics scene.                                                                            |
| [SyncTransforms](/engine/6000.0/script-reference/unityengine/physics2d/synctransforms.md)                   | Synchronizes.                                                                                                             |
