# Physics

> Global physics properties and helper methods.

## Definition

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

```csharp
public class Physics
```

## Static Fields

| Value                                                                                               | Description                                           |
| --------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
| [AllLayers](/engine/6000.7/script-reference/unityengine/physics/alllayers.md)                       | Layer mask constant to select all layers.             |
| [DefaultRaycastLayers](/engine/6000.7/script-reference/unityengine/physics/defaultraycastlayers.md) | Layer mask constant to select default raycast layers. |
| [IgnoreRaycastLayer](/engine/6000.7/script-reference/unityengine/physics/ignoreraycastlayer.md)     | Layer mask constant to select ignore raycast layer.   |

## Static Properties

| Property                                                                                                                  | Description                                                                                                                                         |
| ------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
| [bounceThreshold](/engine/6000.7/script-reference/unityengine/physics/bouncethreshold.md)                                 | Two colliding objects with a relative velocity below this will not bounce (default 2). Must be positive.                                            |
| [clothGravity](/engine/6000.7/script-reference/unityengine/physics/clothgravity.md)                                       | Cloth Gravity setting. Set gravity for all cloth components.                                                                                        |
| [defaultContactOffset](/engine/6000.7/script-reference/unityengine/physics/defaultcontactoffset.md)                       | The default contact offset of the newly created colliders.                                                                                          |
| [defaultMaxAngularSpeed](/engine/6000.7/script-reference/unityengine/physics/defaultmaxangularspeed.md)                   | Default maximum angular speed of the dynamic Rigidbody, in radians (default 50).                                                                    |
| [defaultMaxDepenetrationVelocity](/engine/6000.7/script-reference/unityengine/physics/defaultmaxdepenetrationvelocity.md) | The maximum default velocity needed to move a Rigidbody's collider out of another collider's surface penetration. Must be positive.                 |
| [defaultPhysicsScene](/engine/6000.7/script-reference/unityengine/physics/defaultphysicsscene.md)                         | The [PhysicsScene](/engine/6000.7/script-reference/unityengine/physicsscene.md) automatically created when Unity starts.                            |
| [defaultSolverIterations](/engine/6000.7/script-reference/unityengine/physics/defaultsolveriterations.md)                 | The defaultSolverIterations determines how accurately Rigidbody joints and collision contacts are resolved. (default 6). Must be positive.          |
| [defaultSolverVelocityIterations](/engine/6000.7/script-reference/unityengine/physics/defaultsolvervelocityiterations.md) | The defaultSolverVelocityIterations affects how accurately the Rigidbody joints and collision contacts are resolved. (default 1). Must be positive. |
| [generateOnTriggerStayEvents](/engine/6000.7/script-reference/unityengine/physics/generateontriggerstayevents.md)         | Whether the physics system sends `OnTriggerStay` events.                                                                                            |
| [gravity](/engine/6000.7/script-reference/unityengine/physics/gravity.md)                                                 | The gravity applied to all rigid bodies in the Scene.                                                                                               |
| [improvedPatchFriction](/engine/6000.7/script-reference/unityengine/physics/improvedpatchfriction.md)                     | Enables an improved patch friction mode that guarantees static and dynamic friction do not exceed analytical results.                               |
| [interCollisionDistance](/engine/6000.7/script-reference/unityengine/physics/intercollisiondistance.md)                   | Sets the minimum separation distance for cloth inter-collision.                                                                                     |
| [interCollisionStiffness](/engine/6000.7/script-reference/unityengine/physics/intercollisionstiffness.md)                 | Sets the cloth inter-collision stiffness.                                                                                                           |
| [invokeCollisionCallbacks](/engine/6000.7/script-reference/unityengine/physics/invokecollisioncallbacks.md)               | Whether or not [MonoBehaviour](/engine/6000.7/script-reference/unityengine/monobehaviour.md) collision messages will be sent by the physics system. |
| [queriesHitBackfaces](/engine/6000.7/script-reference/unityengine/physics/querieshitbackfaces.md)                         | Whether physics queries should hit back-face triangles.                                                                                             |
| [queriesHitTriggers](/engine/6000.7/script-reference/unityengine/physics/querieshittriggers.md)                           | Specifies whether queries (raycasts, spherecasts, overlap tests, etc.) hit Triggers by default.                                                     |
| [reuseCollisionCallbacks](/engine/6000.7/script-reference/unityengine/physics/reusecollisioncallbacks.md)                 | Determines whether the garbage collector should reuse only a single instance of a Collision type for all collision callbacks.                       |
| [simulationMode](/engine/6000.7/script-reference/unityengine/physics/simulationmode.md)                                   | Controls when Unity executes the physics simulation.                                                                                                |
| [sleepThreshold](/engine/6000.7/script-reference/unityengine/physics/sleepthreshold.md)                                   | The mass-normalized energy threshold, below which objects start going to sleep.                                                                     |

## Static Methods

| Method                                                                                                      | Description                                                                                                                                                          |
| ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [BakeMesh](/engine/6000.7/script-reference/unityengine/physics/bakemesh.md)                                 | Prepares the mesh for use with a [MeshCollider](/engine/6000.7/script-reference/unityengine/meshcollider.md) and uses default cooking options.                       |
| [BoxCast](/engine/6000.7/script-reference/unityengine/physics/boxcast.md)                                   | Casts the box along a ray and returns detailed information on what was hit.                                                                                          |
| [BoxCastAll](/engine/6000.7/script-reference/unityengine/physics/boxcastall.md)                             | Like [Physics.BoxCast](/engine/6000.7/script-reference/unityengine/physics/boxcast.md), but returns all hits.                                                        |
| [BoxCastNonAlloc](/engine/6000.7/script-reference/unityengine/physics/boxcastnonalloc.md)                   | Cast the box along the direction, and store hits in the provided buffer.                                                                                             |
| [CapsuleCast](/engine/6000.7/script-reference/unityengine/physics/capsulecast.md)                           | Casts a capsule against all colliders in the Scene and returns detailed information on what was hit.                                                                 |
| [CapsuleCastAll](/engine/6000.7/script-reference/unityengine/physics/capsulecastall.md)                     | Like [Physics.CapsuleCast](/engine/6000.7/script-reference/unityengine/physics/capsulecast.md), but this function will return all hits the capsule sweep intersects. |
| [CapsuleCastNonAlloc](/engine/6000.7/script-reference/unityengine/physics/capsulecastnonalloc.md)           | Casts a capsule against all colliders in the Scene and returns detailed information on what was hit into the buffer.                                                 |
| [CheckBox](/engine/6000.7/script-reference/unityengine/physics/checkbox.md)                                 | Check whether the given box overlaps with other colliders or not.                                                                                                    |
| [CheckCapsule](/engine/6000.7/script-reference/unityengine/physics/checkcapsule.md)                         | Checks if any colliders overlap a capsule-shaped volume in world space.                                                                                              |
| [CheckSphere](/engine/6000.7/script-reference/unityengine/physics/checksphere.md)                           | Returns true if there are any colliders overlapping the sphere defined by `position` and `radius` in world coordinates.                                              |
| [ClosestPoint](/engine/6000.7/script-reference/unityengine/physics/closestpoint.md)                         | Returns a point on the given collider that is closest to the specified location.                                                                                     |
| [ComputePenetration](/engine/6000.7/script-reference/unityengine/physics/computepenetration.md)             | Compute the minimal translation required to separate the given colliders apart at specified poses.                                                                   |
| [GetIgnoreCollision](/engine/6000.7/script-reference/unityengine/physics/getignorecollision.md)             | Checks whether the collision detection system will ignore all collisions/triggers between `collider1` and `collider2` or not.                                        |
| [GetIgnoreLayerCollision](/engine/6000.7/script-reference/unityengine/physics/getignorelayercollision.md)   | Are collisions between `layer1` and `layer2` being ignored?                                                                                                          |
| [IgnoreCollision](/engine/6000.7/script-reference/unityengine/physics/ignorecollision.md)                   | Makes the collision detection system ignore all collisions between `collider1` and `collider2`.                                                                      |
| [IgnoreLayerCollision](/engine/6000.7/script-reference/unityengine/physics/ignorelayercollision.md)         | Makes the collision detection system ignore all collisions between any collider in layer1 and any collider in layer2.                                                |
| [Linecast](/engine/6000.7/script-reference/unityengine/physics/linecast.md)                                 | Returns true if there is any collider intersecting the line between `start` and `end`.                                                                               |
| [OverlapBox](/engine/6000.7/script-reference/unityengine/physics/overlapbox.md)                             | Find all colliders touching or inside of the given box.                                                                                                              |
| [OverlapBoxNonAlloc](/engine/6000.7/script-reference/unityengine/physics/overlapboxnonalloc.md)             | Find all colliders touching or inside of the given box, and store them into the buffer.                                                                              |
| [OverlapCapsule](/engine/6000.7/script-reference/unityengine/physics/overlapcapsule.md)                     | Check the given capsule against the physics world and return all overlapping colliders.                                                                              |
| [OverlapCapsuleNonAlloc](/engine/6000.7/script-reference/unityengine/physics/overlapcapsulenonalloc.md)     | Check the given capsule against the physics world and return all overlapping colliders in the user-provided buffer.                                                  |
| [OverlapSphere](/engine/6000.7/script-reference/unityengine/physics/overlapsphere.md)                       | Computes and stores colliders touching or inside the sphere.                                                                                                         |
| [OverlapSphereNonAlloc](/engine/6000.7/script-reference/unityengine/physics/overlapspherenonalloc.md)       | Computes and stores colliders touching or inside the sphere into the provided buffer.                                                                                |
| [Raycast](/engine/6000.7/script-reference/unityengine/physics/raycast.md)                                   | Same as above using /ray.origin/ and /ray.direction/ instead of `origin` and `direction`.                                                                            |
| [RaycastAll](/engine/6000.7/script-reference/unityengine/physics/raycastall.md)                             | Casts a ray through the Scene and returns all hits. Note that order of the results is undefined.                                                                     |
| [RaycastNonAlloc](/engine/6000.7/script-reference/unityengine/physics/raycastnonalloc.md)                   | Cast a ray through the Scene and store the hits into the buffer.                                                                                                     |
| [RebuildBroadphaseRegions](/engine/6000.7/script-reference/unityengine/physics/rebuildbroadphaseregions.md) | Rebuild the broadphase interest regions as well as set the world boundaries.                                                                                         |
| [Simulate](/engine/6000.7/script-reference/unityengine/physics/simulate.md)                                 | Simulate physics in the Scene.                                                                                                                                       |
| [SphereCast](/engine/6000.7/script-reference/unityengine/physics/spherecast.md)                             | Casts a sphere along a ray and returns detailed information on what was hit.                                                                                         |
| [SphereCastAll](/engine/6000.7/script-reference/unityengine/physics/spherecastall.md)                       | Like [Physics.SphereCast](/engine/6000.7/script-reference/unityengine/physics/spherecast.md), but this function will return all hits the sphere sweep intersects.    |
| [SphereCastNonAlloc](/engine/6000.7/script-reference/unityengine/physics/spherecastnonalloc.md)             | Cast sphere along the direction and store the results into buffer.                                                                                                   |
| [SyncTransforms](/engine/6000.7/script-reference/unityengine/physics/synctransforms.md)                     | Apply Transform changes to the physics engine.                                                                                                                       |

## Static Events

| Member                                                                                                | Description                                                                                            |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| [ContactEvent](/engine/6000.7/script-reference/unityengine/physics/contactevent.md)                   | Subscribe to this event to read all collisions that occurred during the physics simulation step.       |
| [ContactModifyEvent](/engine/6000.7/script-reference/unityengine/physics/contactmodifyevent.md)       | Subscribe to this event to be able to customize the collision response for contact pairs.              |
| [ContactModifyEventCCD](/engine/6000.7/script-reference/unityengine/physics/contactmodifyeventccd.md) | Subscribe to this event to be able to customize the collision response of CCD generated contact pairs. |
