---
title: Collision detection
framework: realitykit
role: collectionGroup
role_heading: API Collection
path: realitykit/physics-collision-detection
---

# Collision detection

Determine when entities collide with each other or the environment.

## Overview

Overview RealityKit can automatically detect when two objects participating in the physics system collide with each other if both entities have a CollisionComponent with at least one collision shape. Because doing collision detection with complex 3D models can be computationally expensive, collision shapes are simpler, invisible shapes RealityKit uses to detect collision, as well as doing hit testing, ray casts, and convex shape casts. Entities can participate in the scene simulation in two different modes: as a rigid body or as a trigger. A rigid body fully participates in the collision simulation. It affects the velocity and direction of other rigid body entities with which it collides. An entity with a rigid body mode of PhysicsBodyMode.dynamic, other rigid body entities can affect its velocity and direction. A trigger entity doesn’t have any impact on the other rigid bodies in the scene, but can trigger code or Reality Composer Pro behaviors when another rigid body entity overlaps it. Turn an entity into a trigger by adding a CollisionComponent to it and setting its mode to CollisionComponent.Mode.trigger. Turn an entity into a rigid body by adding a PhysicsBodyComponent to the entity in addition to a CollisionComponent. The PhysicsBodyComponent defines the physical properties of the entity, such as its mass and collision shape. note: RealityKit ignores an entity’s collision component mode if the entity also has a PhysicsBodyComponent. An entity can be a rigid body, or a trigger, but not both at the same time.

## Topics

### Collision shapes and groups

- [Simulating physics with collisions in your visionOS app](realitykit/simulating-physics-with-collisions-in-your-visionos-app.md)
- [Configuring Collision in RealityKit](realitykit/configuring-collision-in-realitykit.md)
- [Creating an interactive 3D model in visionOS](visionos/creating-an-interactable-3d-model-in-visionos.md)
- [CollisionComponent](realitykit/collisioncomponent.md)
- [CollisionComponent.Mode](realitykit/collisioncomponent/mode-swift.enum.md)
- [ShapeResource](realitykit/shaperesource.md)
- [ShapeResourceError](realitykit/shaperesourceerror.md)
- [CollisionGroup](realitykit/collisiongroup.md)
- [CollisionFilter](realitykit/collisionfilter.md)
- [TriggerVolume](realitykit/triggervolume.md)

### Collision-related notifications

- [CollisionEvents](realitykit/collisionevents.md)
- [Contact](realitykit/contact.md)

### Ray casting

- [CollisionCastHit](realitykit/collisioncasthit.md)
- [CollisionCastHit.TriangleHit](realitykit/collisioncasthit/trianglehit-swift.struct.md)
- [CollisionCastQueryType](realitykit/collisioncastquerytype.md)
- [PixelCastHit](realitykit/pixelcasthit.md)

### Entity compliance

- [HasCollision](realitykit/hascollision.md)

## See Also

### Physics simulation

- [Simulations and motion](realitykit/physics-simulations-and-motion.md)
- [Force effects](realitykit/physics-force-effects.md)
- [Physics joints and pins](realitykit/physics-joints-and-pins.md)
- [Cloth simulation](realitykit/physics-cloth-simulation.md)
