Collision detection is the computational process of identifying when two or more simulated objects in a physics engine have come into contact or intersected. It is a critical prerequisite for calculating contact forces and enforcing non-penetration constraints. The process is typically divided into a broad phase, which uses spatial data structures like a Bounding Volume Hierarchy (BVH) to quickly filter non-colliding pairs, and a narrow phase, which performs precise geometric tests on candidate pairs to compute intersection details.
Glossary
Collision Detection

What is Collision Detection?
Collision detection is the foundational computational process within a physics engine for identifying when two or more simulated objects intersect or come into contact.
For convex shapes, algorithms like GJK (Gilbert-Johnson-Keerthi) and EPA (Expanding Polytope Algorithm) efficiently determine collision and penetration depth. To prevent fast-moving objects from tunneling through thin geometry, Continuous Collision Detection (CCD) checks the swept volume across a time step. The output—contact points, normals, and penetration depth—feeds the constraint solver (e.g., solving a Linear Complementarity Problem) to compute physically correct collision responses, making it essential for Sim-to-Real Transfer Learning in robotic training.
Collision Detection
Collision detection is the computational process of identifying when two or more simulated objects in a physics engine have come into contact or intersected. It is a foundational component for simulating realistic physical interactions in robotics, gaming, and computer-aided design.
Broad Phase
The broad phase is the initial, computationally cheap filtering step that quickly identifies pairs of objects that are potentially colliding. It uses spatial partitioning data structures to avoid the expensive O(n²) pairwise checks of all objects in a scene.
- Purpose: Cull obviously non-colliding pairs.
- Common Techniques: Bounding Volume Hierarchies (BVH), Spatial Hashing, and Sweep and Prune.
- Output: A reduced list of candidate pairs for the narrow phase.
Narrow Phase
The narrow phase performs precise geometric intersection tests on the candidate pairs identified by the broad phase. It determines if a collision has actually occurred and computes detailed contact information.
- Purpose: Exact collision boolean and contact data generation.
- Key Data Output: Contact point(s), penetration depth, and contact normal.
- Algorithms: GJK/EPA for convex shapes, SAT (Separating Axis Theorem) for convex polygons, and specialized tests for primitives (sphere-sphere, box-box).
Continuous Collision Detection (CCD)
Continuous Collision Detection (CCD) prevents the tunneling effect, where a fast-moving object passes completely through a thin object between discrete time steps. It checks for intersections between the swept volumes of objects across the time interval.
- Use Case: Essential for simulating bullets, fast-moving robots, or objects in low-framerate simulations.
- Method: Models motion as continuous, often using ray casting or conservative advancement.
- Trade-off: Significantly more computationally expensive than discrete detection.
Bounding Volume Hierarchies (BVH)
A Bounding Volume Hierarchy (BVH) is a tree data structure that recursively groups objects using bounding volumes (like Axis-Aligned Bounding Boxes - AABBs, or spheres). It accelerates both collision detection and ray casting.
- Structure: Each node stores a BV that encloses all geometry of its children.
- Traversal: The tree is traversed, discarding entire branches if their BVs do not intersect.
- Dynamic vs. Static: Static BVHs are built once for immovable geometry; dynamic BVHs require update strategies (refitting, rebuilding) for moving objects.
The GJK Algorithm
The Gilbert–Johnson–Keerthi (GJK) algorithm is an iterative method for computing the distance between two convex shapes and detecting collision. It operates on the Minkowski difference of the two shapes.
- Core Insight: Two convex sets intersect if and only if their Minkowski difference contains the origin.
- Process: Uses a support function to iteratively build a simplex (point, line, triangle, tetrahedron) within the Minkowski difference to find the closest point to the origin.
- EPA Companion: When a collision is detected, the Expanding Polytope Algorithm (EPA) is often used with GJK to compute the penetration depth and contact normal.
Contact Generation
Contact generation is the final step of the narrow phase, producing the specific data required by the constraint solver to resolve the collision physically. This data forms the contact manifold.
- Critical Outputs:
- Contact Point: The point(s) of intersection or deepest penetration.
- Contact Normal: A unit vector perpendicular to the collision surface, pointing from object B to object A.
- Penetration Depth: The distance the objects overlap.
- Manifold Types: For simple shapes, this may be a single point; for flat faces colliding, it is a set of points defining the contact area (e.g., clipping polygon-polygon contacts).
Broad Phase vs. Narrow Phase: A Comparison
A comparison of the two primary stages in the collision detection pipeline, detailing their distinct purposes, algorithmic approaches, and computational characteristics.
| Feature | Broad Phase | Narrow Phase |
|---|---|---|
Primary Purpose | Efficient culling of non-interacting object pairs | Precise intersection test for candidate pairs |
Algorithmic Approach | Spatial partitioning (BVH, Grids, Sweep & Prune) | Geometric intersection (GJK/EPA, SAT, MPR) |
Computational Complexity | O(n log n) or O(n) with good data structures | O(1) per pair, but geometrically intensive |
Output | List of potentially colliding pairs (AABB overlaps) | Exact contact points, normals, and penetration depth |
Handles Non-Convex Shapes | ||
Prevents Tunneling (Fast Objects) | ||
Typical Bounding Volume | Axis-Aligned Bounding Box (AABB) | Convex Hull, Polygon Mesh |
Parallelization Potential | High (independent tree traversals) | Moderate (per-pair tests are independent) |
Primary Applications in AI and Robotics
Collision detection is a foundational computational process for simulating physical interactions. Its primary applications span from ensuring safe robotic operation to enabling complex virtual training environments.
Robotic Manipulation and Grasping
Collision detection is critical for robotic arms performing pick-and-place or assembly tasks. It prevents the gripper or arm from colliding with:
- The target object itself during approach
- Other objects in the workspace (e.g., bins, tools)
- The robot's own body (self-collision)
Precise contact point calculation from the narrow phase informs grasp stability analysis and allows for compliant control strategies, where the robot can sense and react to unexpected contact.
Autonomous Navigation and Path Planning
For autonomous mobile robots (AMRs) and drones, collision detection is integral to local obstacle avoidance and global path planning. The broad phase uses spatial partitioning structures like Bounding Volume Hierarchies (BVHs) to quickly identify potential obstacles near the robot's planned trajectory. This enables real-time replanning to navigate dynamic environments like warehouses or hospitals safely, forming a core part of the perception-action loop for embodied AI.
Simulation for Reinforcement Learning (Sim2Real)
In Sim-to-Real Transfer Learning, high-fidelity physics simulations train reinforcement learning (RL) policies. Accurate collision detection provides the necessary contact signals for reward calculation and state observation.
- Contact rewards: Rewards for successful tool use or object manipulation.
- Failure penalties: Terminating episodes where unsafe collisions occur.
- Domain randomization: Varying collision geometry and material properties (Coefficient of Restitution, friction) during training to create robust policies that transfer to physical robots.
Digital Twin and Hardware-in-the-Loop Validation
Digital twins are virtual replicas used for testing and predictive maintenance. Collision detection validates that a robot's programmed motions will not cause impacts in the real workspace before deployment. In Hardware-in-the-Loop (HIL) testing, the physical robot controller interacts with a simulated environment; fast, deterministic collision feedback is essential for validating control software under edge-case scenarios without physical risk.
Human-Robot Interaction (HRI) Safety
For collaborative robots (cobots) working alongside humans, collision detection is a primary safety feature. Systems often use a combination of:
- Proximity sensing (pre-collision): Slows or stops the robot based on distance.
- Contact detection (post-collision): Uses joint torque sensors or external skin sensors to detect unexpected force. Upon detection, the robot executes a protective stop or moves along a compliant path. This requires extremely low-latency detection and response, often implemented via dedicated safety controllers.
Articulated System Self-Collision
Complex robots like humanoid robots or snake-like manipulators must avoid hitting themselves. This requires continuous checking for collisions between many moving links in the kinematic chain. Efficient algorithms are necessary, as a naive pairwise check between N links is O(N²). Solutions often involve:
- Modeling each link with simplified collision primitives (capsules, convex hulls).
- Using BVHs that are updated with the robot's configuration.
- Continuous Collision Detection (CCD) for fast-moving limbs to prevent tunneling through thin parts of its own body.
Frequently Asked Questions
Collision detection is the computational process of identifying when two or more simulated objects in a physics engine have come into contact or intersected. It is a foundational component for simulating realistic physical interactions in robotics, gaming, and digital twins.
Collision detection is the computational process of identifying when two or more simulated objects in a physics engine have come into contact or intersected. It is critical because it provides the necessary data for the constraint solver to compute contact forces, enabling realistic physical interactions like pushing, stacking, and grasping. Without accurate collision detection, objects would pass through each other, breaking the simulation's physical plausibility and making it useless for training robotic policies or validating mechanical designs. It is the first and most performance-sensitive step in the contact resolution pipeline.
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 foundational component within physics simulation. Its operation and results are deeply intertwined with the following core concepts that define how contact is resolved and motion is calculated.
Contact Force
The contact force is the resultant force calculated at the point of intersection identified by the collision detection system. It is decomposed into two components:
- Normal Force: Acts perpendicular to the contact surface, preventing inter-penetration.
- Tangential (Friction) Force: Acts parallel to the contact surface, resisting sliding motion. The magnitude of the friction force is governed by the Coulomb friction model, which is proportional to the normal force and the material's friction coefficient.
Continuous Collision Detection (CCD)
Continuous Collision Detection is an advanced method that prevents tunneling, where fast-moving or small objects pass through thin geometry in a single simulation time step. Instead of checking for overlap at discrete points in time, CCD tests for intersections between the swept volumes of objects across the entire time interval. This is computationally intensive but critical for simulating bullets, high-speed robots, or particles.
Bounding Volume Hierarchy (BVH)
A Bounding Volume Hierarchy is a core acceleration data structure used in the broad phase of collision detection. It is a tree where each node contains a simple bounding volume (e.g., an Axis-Aligned Bounding Box or sphere) that encloses all geometry beneath it. This allows the system to quickly cull large groups of objects that are far apart by testing their bounding volumes, reducing the number of expensive narrow phase pairwise checks from O(n²) to O(n log n) or better.
Linear Complementarity Problem (LCP)
The Linear Complementarity Problem is a mathematical framework used by many physics engines to model and solve contact and friction constraints simultaneously. It formulates the conditions that contact forces must be non-penetrating (only push, not pull) and non-adhesive. Solvers iterate to find forces that satisfy:
- Bodies do not inter-penetrate.
- Contact forces are zero unless bodies are touching.
- Friction forces lie within the friction cone. This provides a robust, though computationally complex, solution for stable stacking and resting contact.
Constraint Solver
The constraint solver is the algorithmic core that takes the list of contact points and penetration data from the collision detector and calculates the appropriate forces or impulses to resolve them. It works to satisfy constraints (like non-penetration and joint limits) over multiple iterations within a single time step. Techniques like warm starting (using the previous solution as an initial guess) and Baumgarte stabilization (adding corrective energy to reduce constraint drift) are commonly used within the solver to improve performance and stability.
Penalty Method
The penalty method is an alternative to LCP-based constraint solvers for handling contact. It models collisions using a spring-damper system. When penetration is detected, a force is applied that is proportional to:
- Penetration Depth: How far the objects have intersected.
- Penetration Velocity: The speed at which they are moving into each other. This method is conceptually simpler and can be easier to implement but requires careful tuning of stiffness and damping coefficients to avoid overly bouncy or unstable simulations.

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