<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/CollisionComponent",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation18CollisionComponentV"
  },
  "title" : "CollisionComponent"
}
-->

# CollisionComponent

A component that gives an entity the ability to collide with other entities
that also have collision components.

```
struct CollisionComponent
```

## Overview

This component holds the entity’s data related to participating in the scene’s
physics simulation. It is also used to calculate collision queries, raycasts, 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
entities it collides. If configured with a rigid body [`mode`](/documentation/RealityKit/PhysicsBodyComponent/mode)
of [`PhysicsBodyMode.dynamic`](/documentation/RealityKit/PhysicsBodyMode/dynamic), it’s own velocity and direction can be affected
by other rigid body entities. A trigger entity doesn’t have any impact on the rigid bodies in the scene, but
can trigger code or Reality Composer behaviors when a rigid body entity overlaps it.

Note the following when considering applying a non-uniform scale to an entity:

- Non-uniform scaling is applicable only to box, convex mesh and triangle mesh collision shapes.
- Non-uniform scaling is not supported for all other types of collision shapes. In this case the scale.x
  value is duplicated to the scale’s y and z components as well to force scale uniformity based on the x component.
- If the entity has a non-uniform scale assigned to its transform then that entity should not
  have any descendants assigned that contain rotations in their transforms. A good rule of thumb is to
  assign the non-uniform scale to the entity that has the collision shape, and avoid adding children below
  that entity.

Turn an entity into a trigger by adding a [`CollisionComponent`](/documentation/RealityKit/CollisionComponent) to it and setting its
[`mode`](/documentation/RealityKit/CollisionComponent/mode-swift.property) to
[`CollisionComponent.Mode.trigger`](/documentation/RealityKit/CollisionComponent/Mode-swift.enum/trigger).

Turn an entity into a *rigid body* by adding a  [`PhysicsBodyComponent`](/documentation/RealityKit/PhysicsBodyComponent) to the
entity in addition to a [`CollisionComponent`](/documentation/RealityKit/CollisionComponent).  The [`PhysicsBodyComponent`](/documentation/RealityKit/PhysicsBodyComponent)
defines the physical properties of the entity, such as its mass and collision shape.

The `filter` property defines the entity’s collision filter, which determines which other objects the entity
collides with. For more information, see <doc://com.apple.documentation/documentation/realitykit/controlling_entity_collisions_in_realitykit>.

> Note: If an entity has a ``doc://com.apple.RealityKit/documentation/RealityKit/PhysicsBodyComponent``, the  collision component’s
> mode is ignored. An entity can be a rigid body, or a trigger, but not both at the same time.

## Topics

### Creating the collision component

[`init(shapes:mode:filter:)`](/documentation/RealityKit/CollisionComponent/init(shapes:mode:filter:))

Creates a collision component with the given collision shape, mode, and
filter parameters.

### Setting the collision mode

[`mode`](/documentation/RealityKit/CollisionComponent/mode-swift.property)

The collision mode.

### Filtering collisions

[`filter`](/documentation/RealityKit/CollisionComponent/filter)

The collision filter used to segregate entities into different collision
groups.

### Setting collision shapes

[`shapes`](/documentation/RealityKit/CollisionComponent/shapes)

A collection of shape resources that collectively represent the outer
dimensions of an entity for the purposes of collision detection.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)