Global settings and helpers for 2D physics.
AllLayers | Layer mask constant that includes all layers. |
alwaysShowColliders | Should the collider gizmos always be shown even when they are not selected? |
angularSleepTolerance | A rigid-body cannot sleep if its angular velocity is above this tolerance. |
autoSimulation | Sets whether the physics should be simulated automatically or not. |
autoSyncTransforms | Whether or not to automatically sync transform changes with the physics system whenever a Transform component changes. |
baumgarteScale | The scale factor that controls how fast overlaps are resolved. |
baumgarteTOIScale | The scale factor that controls how fast TOI overlaps are resolved. |
callbacksOnDisable | Use this to control whether or not the appropriate OnCollisionExit2D or OnTriggerExit2D callbacks should be called when a Collider2D is disabled. |
colliderAABBColor | Sets the color used by the gizmos to show all Collider axis-aligned bounding boxes (AABBs). |
colliderAsleepColor | The color used by the gizmos to show all asleep colliders (collider is asleep when the body is asleep). |
colliderAwakeColor | The color used by the gizmos to show all awake colliders (collider is awake when the body is awake). |
colliderContactColor | The color used by the gizmos to show all collider contacts. |
contactArrowScale | The scale of the contact arrow used by the collider gizmos. |
defaultContactOffset | The default contact offset of the newly created colliders. |
defaultPhysicsScene | The PhysicsScene2D automatically created when Unity starts. |
DefaultRaycastLayers | Layer mask constant that includes all layers participating in raycasts by default. |
gravity | Acceleration due to gravity. |
IgnoreRaycastLayer | Layer mask constant for the default layer that ignores raycasts. |
jobOptions | A set of options that control how physics operates when using the job system to multithread the physics simulation. |
linearSleepTolerance | A rigid-body cannot sleep if its linear velocity is above this tolerance. |
maxAngularCorrection | The maximum angular position correction used when solving constraints. This helps to prevent overshoot. |
maxLinearCorrection | The maximum linear position correction used when solving constraints. This helps to prevent overshoot. |
maxRotationSpeed | The maximum angular speed of a rigid-body per physics update. Increasing this can cause numerical problems. |
maxTranslationSpeed | The maximum linear speed of a rigid-body per physics update. Increasing this can cause numerical problems. |
positionIterations | The number of iterations of the physics solver when considering objects' positions. |
queriesHitTriggers | Do raycasts detect Colliders configured as triggers? |
queriesStartInColliders | Sets the raycasts or linecasts that start inside Colliders to detect or not detect those Colliders. |
showColliderAABB | Should the collider gizmos show the AABBs for each collider? |
showColliderContacts | Should the collider gizmos show current contacts for each collider? |
showColliderSleep | Should the collider gizmos show the sleep-state for each collider? |
timeToSleep | The time in seconds that a rigid-body must be still before it will go to sleep. |
velocityIterations | The number of iterations of the physics solver when considering objects' velocities. |
velocityThreshold | Any collisions with a relative linear velocity below this threshold will be treated as inelastic. |
BoxCast | Casts a box against colliders in the Scene, returning the first collider to contact with it. |
BoxCastAll | Casts a box against colliders in the Scene, returning all colliders that contact with it. |
BoxCastNonAlloc | Casts a box into the Scene, returning colliders that contact with it into the provided results array. |
CapsuleCast | Casts a capsule against colliders in the Scene, returning the first collider to contact with it. |
CapsuleCastAll | Casts a capsule against colliders in the Scene, returning all colliders that contact with it. |
CapsuleCastNonAlloc | Casts a capsule into the Scene, returning colliders that contact with it into the provided results array. |
CircleCast | Casts a circle against colliders in the Scene, returning the first collider to contact with it. |
CircleCastAll | Casts a circle against colliders in the Scene, returning all colliders that contact with it. |
CircleCastNonAlloc | Casts a circle into the Scene, returning colliders that contact with it into the provided results array. |
Distance | Calculates the minimum distance between two colliders. |
GetContacts | Retrieves all colliders in contact with the collider. |
GetIgnoreCollision | Checks whether the collision detection system will ignore all collisions/triggers between collider1 and collider2 or not. |
GetIgnoreLayerCollision | Checks whether collisions between the specified layers be ignored or not. |
GetLayerCollisionMask | Get the collision layer mask that indicates which layer(s) the specified layer can collide with. |
GetRayIntersection | Cast a 3D ray against the colliders in the Scene returning the first collider along the ray. |
GetRayIntersectionAll | Cast a 3D ray against the colliders in the Scene returning all the colliders along the ray. |
GetRayIntersectionNonAlloc | Cast a 3D ray against the colliders in the Scene returning the colliders along the ray. |
IgnoreCollision | Makes the collision detection system ignore all collisions/triggers between collider1 and collider2. |
IgnoreLayerCollision | Choose whether to detect or ignore collisions between a specified pair of layers. |
IsTouching | Checks whether the passed colliders are in contact or not. |
IsTouchingLayers | Checks whether the collider is touching any colliders on the specified layerMask or not. |
Linecast | Casts a line segment against colliders in the Scene. |
LinecastAll | Casts a line against colliders in the Scene. |
LinecastNonAlloc | Casts a line against colliders in the Scene. |
OverlapArea | Checks if a collider falls within a rectangular area. |
OverlapAreaAll | Get a list of all colliders that fall within a rectangular area. |
OverlapAreaNonAlloc | Get a list of all colliders that fall within a specified area. |
OverlapBox | Checks if a collider falls within a box area. |
OverlapBoxAll | Get a list of all colliders that fall within a box area. |
OverlapBoxNonAlloc | Get a list of all colliders that fall within a box area. |
OverlapCapsule | Checks if a collider falls within a capsule area. |
OverlapCapsuleAll | Get a list of all colliders that fall within a capsule area. |
OverlapCapsuleNonAlloc | Get a list of all colliders that fall within a capsule area. |
OverlapCircle | Checks if a collider falls within a circular area. |
OverlapCircleAll | Get a list of all colliders that fall within a circular area. |
OverlapCircleNonAlloc | Get a list of all colliders that fall within a circular area. |
OverlapCollider | Gets a list of all Colliders that overlap the given collider. |
OverlapPoint | Checks if a collider overlaps a point in space. |
OverlapPointAll | Get a list of all colliders that overlap a point in space. |
OverlapPointNonAlloc | Get a list of all colliders that overlap a point in space. |
Raycast | Casts a ray against colliders in the Scene. |
RaycastAll | Casts a ray against colliders in the Scene, returning all colliders that contact with it. |
RaycastNonAlloc | Casts a ray into the Scene. |
SetLayerCollisionMask | Set the collision layer mask that indicates which layer(s) the specified layer can collide with. |
Simulate | Simulate physics in the Scene. |
SyncTransforms | Synchronizes. |
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.