Skip to main content

Physics

Global physics properties and helper methods. Unity Physics

Members

Properties

NameDescription
Physics.autoSyncTransformsWhether or not to automatically sync transform changes with the physics system whenever a Transform component changes.
Physics.defaultSolverIterationsThe defaultSolverIterations determines how accurately Rigidbody joints and collision contacts are resolved. (default 6). Must be positive.

Static Properties

NameDescription
Physics.AllLayersLayer mask constant to select all layers. (Read-only)
Physics.autoSimulationSets whether the physics should be simulated automatically or not.
Physics.bounceThresholdTwo colliding objects with a relative velocity below this will not bounce (default 2). Must be positive.
Physics.clothGravityCloth Gravity setting. Set gravity for all cloth components.
Physics.defaultContactOffsetThe default contact offset of the newly created colliders.
Physics.defaultMaxAngularSpeedDefault maximum angular speed of the dynamic Rigidbody, in radians (default 50).
Physics.DefaultRaycastLayersLayer mask constant to select default raycast layers. (constant)
Physics.defaultSolverVelocityIterationsThe defaultSolverVelocityIterations affects how accurately the Rigidbody joints and collision contacts are resolved. (default 1). Must be positive.
Physics.gravityThe gravity applied to all rigid bodies in the Scene.
Physics.IgnoreRaycastLayerLayer mask constant to select ignore raycast layer. (constant)
Physics.interCollisionDistanceSets the minimum separation distance for cloth inter-collision. Cloth particles closer than this distance that belong to different Cloth objects will be separated.
Physics.interCollisionStiffnessSets the cloth inter-collision stiffness.
Physics.queriesHitBackfacesWhether physics queries should hit back-face triangles.
Physics.queriesHitTriggersSpecifies 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.reuseCollisionCallbacksDetermines whether the garbage collector should reuse only a single instance of a Collision type for all collision callbacks.
Physics.sleepThresholdThe mass-normalized energy threshold, below which objects start going to sleep.

Static Methods

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