Skip to content

API > Physics


Physics⚓︎

Global physics properties and helper methods. Unity Physics

Members⚓︎

Properties⚓︎

Name Description
Physics.autoSyncTransformsProperty Whether or not to automatically sync transform changes with the physics system whenever a Transform component changes.
Physics.defaultSolverIterationsProperty The defaultSolverIterations determines how accurately Rigidbody joints and collision contacts are resolved. (default 6). Must be positive.

Static Properties⚓︎

Name Description
Physics.AllLayers Static fieldProperty Layer mask constant to select all layers. (Read-only)
Physics.autoSimulation Static fieldProperty Sets whether the physics should be simulated automatically or not.
Physics.bounceThreshold Static fieldProperty Two colliding objects with a relative velocity below this will not bounce (default 2). Must be positive.
Physics.clothGravity Static fieldProperty Cloth Gravity setting. Set gravity for all cloth components.
Physics.defaultContactOffset Static fieldProperty The default contact offset of the newly created colliders.
Physics.defaultMaxAngularSpeed Static fieldProperty Default maximum angular speed of the dynamic Rigidbody, in radians (default 50).
Physics.DefaultRaycastLayers Static fieldProperty Layer mask constant to select default raycast layers. (constant)
Physics.defaultSolverVelocityIterations Static fieldProperty The defaultSolverVelocityIterations affects how accurately the Rigidbody joints and collision contacts are resolved. (default 1). Must be positive.
Physics.gravity Static fieldProperty The gravity applied to all rigid bodies in the Scene.
Physics.IgnoreRaycastLayer Static fieldProperty Layer mask constant to select ignore raycast layer. (constant)
Physics.interCollisionDistance Static fieldProperty Sets the minimum separation distance for cloth inter-collision. Cloth particles closer than this distance that belong to different Cloth objects will be separated.
Physics.interCollisionStiffness Static fieldProperty Sets the cloth inter-collision stiffness.
Physics.queriesHitBackfaces Static fieldProperty Whether physics queries should hit back-face triangles.
Physics.queriesHitTriggers Static fieldProperty Specifies whether queries (raycasts, spherecasts, overlap tests, etc.) hit Triggers by default. This can be overridden on a per-query level by specifying the QueryTriggerInteraction parameter.
Physics.reuseCollisionCallbacks Static fieldProperty Determines whether the garbage collector should reuse only a single instance of a Collision type for all collision callbacks.
Physics.sleepThreshold Static fieldProperty The mass-normalized energy threshold, below which objects start going to sleep.

Static Methods⚓︎

Name Description
Physics.BakeMesh(meshID, convex) Static fieldMethod Prepares the Mesh for use with a MeshCollider.
Physics.BoxCast(physicBox) Static fieldMethod Casts the box along a ray and returns detailed information on what was hit.
Physics.BoxCastAll(physicBox) Static fieldMethod Like Physics.BoxCast, but returns all hits.
Physics.CapsuleCast(physicCapsule) Static fieldMethod Casts a capsule against all colliders in the Scene and returns detailed information on what was hit.
Physics.CapsuleCastAll(physicCapsule) Static fieldMethod Like Physics.CapsuleCast, but this function will return all hits the capsule sweep intersects.
Physics.CheckBox(physicBox) Static fieldMethod Check whether the given box overlaps with other colliders or not.
Physics.CheckCapsule(physicCapsule) Static fieldMethod Checks if any colliders overlap a capsule-shaped volume in world space.
Physics.CheckSphere(physicSphere) Static fieldMethod Returns true if there are any colliders overlapping the sphere defined by PhysicSphere.
Physics.ClosestPoint(point, collider, position, rotation) Static fieldMethod Returns a point on the given collider that is closest to the specified location.
Physics.ComputePenetration(colliderA, positionA, rotationA, colliderB, positionB, rotationB) Static fieldMethod Compute the minimal translation required to separate the given colliders apart at specified poses.
Physics.GetIgnoreCollision(collider1, collider2) Static fieldMethod Checks whether the collision detection system will ignore all collisions/triggers between collider1 and collider2 or not.
Physics.GetIgnoreLayerCollision(layer1, layer2) Static fieldMethod Are collisions between layer1 and layer2 being ignored?
Physics.IgnoreCollision(collider1, collider2, ignore=true) Static fieldMethod Makes the collision detection system ignore all collisions between collider1 and collider2.
Physics.Linecast(physicLine) Static fieldMethod Returns true if there is any collider intersecting the line between start and end.
Physics.OverlapBox(physicBox) Static fieldMethod Find all colliders touching or inside of the given physic box.
Physics.OverlapCapsule(physicCapsule) Static fieldMethod Check the given capsule against the physics world and return all overlapping colliders.
Physics.OverlapSphere(physicSphere) Static fieldMethod Computes and stores colliders touching or inside the sphere.
Physics.Raycast(physicRay) Static fieldMethod Casts a ray, from point origin, in direction direction, of length maxDistance, against all colliders in the Scene.
Physics.RaycastAll(physicRay) Static fieldMethod Casts a ray through the Scene and returns all hits. Note that order of the results is undefined.
Physics.RebuildBroadphaseRegions(worldBounds, subdivisions) Static fieldMethod Rebuild the broadphase interest regions as well as set the world boundaries.
Physics.Simulate(step) Static fieldMethod Simulate physics in the Scene.
Physics.SphereCast(physicSphere) Static fieldMethod Casts a sphere along a ray and returns detailed information on what was hit.
Physics.SphereCastAll(physicSphere) Static fieldMethod Like Physics.SphereCast, but this function will return all hits the sphere sweep intersects.
Physics.SyncTransforms() Static fieldMethod Apply Transform changes to the physics engine.