Version: 2023.2
Language : English
Collision detection
Discrete collision detection

Choose a collision detection mode

CollisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary
Detection
defines which algorithm the physics body (Rigidbody or ArticulationBody) uses to detect collisions. Different algorithms offer different levels of accuracy, but more accurate algorithms require more computational resources.

There are three algorithms available, represented by four collision detectionAn automatic process performed by Unity which determines whether a moving GameObject with a Rigidbody and collider component has come into contact with any other colliders. More info
See in Glossary
modes:

Collision detection mode Algorithm Useful for Not useful for
Discrete Discrete - Slow-moving collisions. - Fast-moving collisions.
Continuous Speculative Speculative CCD - Fast-moving collisions. - Some fast-moving collisions that require an especially high degree of accuracy.
Continuous Sweep CCD - Fast-moving linear collisions that require a high degree of accuracy.
- Physics bodies that only collide with static colliders.
- Collisions that happen as a result of the physics body rotating.
- Physics bodies that collide with moving colliders.
Continuous Dynamic Sweep CCD - Fast-moving linear collisions that require a high degree of accuracy.
- Physics bodies that collide with moving colliders.
- Collisions that happen as a result of the physics body rotating.

For more information on each, see Overview of collision detection modes.

The following decision flow might provide a starting point for selecting a collision detection type. It starts with the least computationally intensive mode, and progresses to the most computationally intensive mode.

  1. Try Discrete first.
  2. If you notice missed collisions in Discrete mode, try Continuous Speculative.
  3. If you notice missed collisions or false collisions in Continuous Speculative mode, try Continuous for collisions with static collidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
    See in Glossary
    , or Continuous Dynamic for collisions with dynamic RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
    See in Glossary
    colliders.

In some cases, you might find that the physics performance relies on a combination of the collision detection mode and the physics timestep frequency. Experiment with both and profile the results to find the right solution for your project.

Select a collision detection mode

To select an algorithm, set the physics body’s Collision Detection property in one of the following ways:

Collision detection
Discrete collision detection