Collision detection is the computational process of identifying when two or more simulated objects intersect or come into contact within a physics engine. It is a foundational component for simulating realistic physical interactions, enabling the calculation of contact forces, constraint resolution, and subsequent object motion. The process is typically divided into a broadphase stage for efficient pair culling and a narrowphase stage for precise geometric intersection tests.
Glossary
Collision Detection

What is Collision Detection?
Collision detection is a fundamental computational process within physics engines, responsible for identifying intersections between simulated objects to enable realistic physical interactions.
Accurate collision detection is critical for Sim-to-Real Transfer Learning, as virtual robots must learn to interact with their environment without interpenetration. Algorithms like the Gilbert–Johnson–Keerthi (GJK) algorithm for convex shapes and data structures like Bounding Volume Hierarchies (BVH) are central to its implementation. For fast-moving objects, Continuous Collision Detection (CCD) prevents tunneling through thin geometry by testing the entire motion path between time steps.
Key Characteristics of Collision Detection
Collision detection is a foundational computational process within physics engines, responsible for identifying when simulated objects intersect. Its efficiency and accuracy are critical for stable simulation, realistic contact response, and real-time performance.
Broadphase vs. Narrowphase
Collision detection is typically a two-stage pipeline designed for efficiency. The broadphase stage uses spatial data structures like Bounding Volume Hierarchies (BVH) or spatial hashing to quickly cull pairs of objects that are too far apart to possibly collide. The narrowphase stage then performs precise geometric tests on the remaining candidate pairs to compute exact contact points, surface normals, and penetration depths using algorithms like GJK or SAT (Separating Axis Theorem).
Discrete vs. Continuous Detection
Discrete Collision Detection (DCD) checks for overlaps at discrete points in time (e.g., each simulation frame). It is computationally efficient but can suffer from tunneling, where fast-moving objects pass through thin geometry. Continuous Collision Detection (CCD) tests for collisions along the entire swept volume of an object's path between time steps, preventing tunneling but at a higher computational cost. CCD is essential for simulating bullets, fast-moving robots, or thin walls.
Convex vs. Non-Convex Shapes
The complexity of collision detection is heavily dependent on object shape. Convex shapes (where any line segment between two points lies entirely within the shape) enable highly efficient algorithms like the Gilbert–Johnson–Keerthi (GJK) algorithm. Non-convex (concave) shapes must be decomposed into convex parts (convex decomposition) or tested using more general but slower methods like mesh-triangle tests. This decomposition is a critical pre-processing step for complex robot parts or environmental assets.
Contact Manifold Generation
Beyond a simple boolean "collide/don't collide," robust simulation requires detailed contact information. The contact manifold is the set of data describing a collision, typically including:
- Contact Points: The world-space points where shapes intersect.
- Contact Normal: A unit vector pointing from one object to the other, defining the collision direction.
- Penetration Depth: The distance the objects overlap. This manifold is the essential input for the constraint solver, which calculates the impulses to resolve the interpenetration and simulate friction and restitution.
Spatial Acceleration Structures
To avoid the O(n²) complexity of checking every object pair, physics engines rely on spatial data structures to accelerate queries. Common structures include:
- Bounding Volume Hierarchy (BVH): A tree of nested bounding volumes (spheres, AABBs, OBBs).
- Spatial Hash Grid / Uniform Grid: Space is divided into fixed-size cells; objects are checked against others in the same or neighboring cells.
- Sort and Sweep: Objects' AABBs are sorted along a principal axis; only overlapping intervals are tested. The choice of structure balances build time, update cost (for dynamic objects), and query performance.
Role in the Physics Pipeline
Collision detection is not an isolated process but a core component of the physics pipeline. Its outputs directly feed subsequent stages:
- Broadphase & Narrowphase: Generate potential and actual contacts.
- Contact Generation & Persistence: Manifolds are created and tracked across frames for stability.
- Constraint Formulation: Contacts are converted into non-penetration and friction constraints.
- Constraint Solver: A solver (like PGS or Sequential Impulses) calculates forces to satisfy all constraints.
- Time Integration: Forces are applied, and positions/velocities are updated for the next frame.
Discrete vs. Continuous Collision Detection
A comparison of the two primary algorithmic approaches for detecting intersections between simulated objects in a physics engine.
| Feature / Metric | Discrete Collision Detection (DCD) | Continuous Collision Detection (CCD) |
|---|---|---|
Core Principle | Tests for overlaps at discrete points in time (e.g., at the end of each simulation step). | Tests for overlaps across the entire continuous path of motion between time steps. |
Primary Use Case | General-purpose simulation where objects move relatively slowly compared to their size and the time step. | Preventing 'tunneling' for fast-moving objects (e.g., bullets) or thin geometry. |
Computational Cost | Lower. Typically involves standard broadphase/narrowphase checks at a single state. | Higher. Requires swept-volume tests, ray casts, or conservative advancement along motion paths. |
Tunneling Prevention | ||
Required for Determinism | ||
Implementation Complexity | Standard. Integrated into most physics engines by default. | Advanced. Often requires explicit enabling and configuration per object. |
Typical Algorithmic Basis | GJK/EPA, SAT, bounding volume tests at a static pose. | Swept sphere/volume tests, conservative advancement, continuous GJK. |
Impact on Simulation Stability | Can cause instability (jitter, penetration) if objects move significantly between steps. | Improves stability for fast motion but can introduce 'ghost collisions' or increase solver complexity. |
Frequently Asked Questions
Collision detection is the foundational computational process within a physics engine that identifies when and where simulated objects intersect. This FAQ addresses its core mechanisms, performance considerations, and role in bridging simulation to reality.
Collision detection is the computational process within a physics engine that identifies when two or more simulated objects intersect or come into contact. It is the critical first step before calculating contact forces and resolving the physical response. The process is typically broken into two main phases: the broadphase, which quickly culls obviously non-colliding pairs using spatial data structures like a Bounding Volume Hierarchy (BVH), and the narrowphase, which performs precise geometric tests on the remaining pairs to compute exact contact points, surface normals, and penetration depths. This data is then passed to a constraint solver to resolve the collision and simulate realistic physical interaction.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Collision detection is a core component of the physics pipeline. These related terms define the algorithms, data structures, and computational stages that make fast and accurate contact resolution possible.
Broadphase
The first, coarse stage in the collision detection pipeline. Its purpose is to efficiently cull pairs of objects that are obviously not colliding, reducing the number of expensive precise checks needed.
- Uses spatial data structures like Bounding Volume Hierarchies (BVH), grids, or sweep-and-prune.
- Algorithms aim for O(n log n) or better complexity.
- Critical for performance in scenes with thousands of objects.
Narrowphase
The second, precise stage where potentially colliding pairs from the broadphase are tested in detail. This stage computes exact geometric information about the contact.
- Calculates contact points, surface normals, and penetration depth.
- Employs algorithms like GJK (Gilbert–Johnson–Keerthi) for convex shapes or SAT (Separating Axis Theorem).
- Output is a set of contact manifolds passed to the constraint solver.
Continuous Collision Detection (CCD)
A technique that prevents tunneling, where fast-moving or small objects pass through thin geometry between discrete time steps. Instead of testing static shapes, CCD tests the swept volume along an object's trajectory.
- Essential for simulating bullets, fast-moving robots, or cloth.
- Computationally more expensive than discrete collision detection.
- Often implemented using conservative advancement or speculative contacts.
Bounding Volume Hierarchy (BVH)
A tree data structure that accelerates collision and ray queries by organizing scene geometry hierarchically. Each node in the tree has a bounding volume (e.g., Axis-Aligned Bounding Box - AABB) that contains all geometry beneath it.
- Enables efficient culling: if two parent volumes don't intersect, none of their children need to be tested.
- Can be built top-down or bottom-up and updated dynamically.
- Also fundamental to ray tracing and rendering engines.
Gilbert–Johnson–Keerthi (GJK) Algorithm
An iterative algorithm that computes the distance between two convex shapes and detects collisions. It operates in the Minkowski difference space, reducing the problem to finding the distance between the origin and this difference shape.
- Highly efficient for convex polyhedra and implicit shapes.
- Often paired with the Expanding Polytope Algorithm (EPA) to calculate penetration depth and contact normal.
- A cornerstone of modern real-time physics engines like Bullet and PhysX.
Contact Generation & Constraint Solving
The stage following narrowphase where contact data is converted into physical constraints for the solver. The solver's job is to compute forces and impulses to resolve interpenetration and model friction.
- Contacts are formulated as velocity-level or position-level constraints.
- Solvers (like PGS - Projected Gauss-Seidel) iteratively satisfy multiple constraints.
- This step enforces non-penetration and applies material properties like restitution and friction.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us