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

# AnchoringComponent

A component that anchors virtual content to a real world target.

```
struct AnchoringComponent
```

## Overview

This component is essential for getting AR features into RealityKit.
Use `AnchoringComponent` to anchor virtual content to a real world target by attaching the component to any [`Entity`](/documentation/RealityKit/Entity) in your RealityKit scene.

To create an `AnchoringComponent`, you need to specify a [`AnchoringComponent.Target`](/documentation/RealityKit/AnchoringComponent/Target-swift.enum). You can also specify the [`AnchoringComponent.TrackingMode`](/documentation/RealityKit/AnchoringComponent/TrackingMode-swift.struct) and the [`AnchoringComponent.PhysicsSimulation`](/documentation/RealityKit/AnchoringComponent/PhysicsSimulation-swift.enum) to control how the entity tracks the anchor and how the physics simulates with the entity.

For example, here’s how to create an entity that targets the left hand’s wrist with predicted tracking mode:

```swift
let target = AnchoringComponent.Target.hand(.left, location: .wrist)
let anchoringComponent = AnchoringComponent(target, trackingMode: .predicted)
let entity = Entity()
entity.components.set(anchoringComponent)
```

The entity with `AnchoringComponent` is inactive when created.
RealityKit anchors and activates the entity when it finds an anchor that meets the target requirements.
You can check the entity’s anchored status using [`SceneEvents.AnchoredStateChanged`](/documentation/RealityKit/SceneEvents/AnchoredStateChanged) events to receive scene events.

Similarly, RealityKit unanchors the entity if the target disappears or no longer meets the target requirements.

For more information about anchors, see <doc://com.apple.documentation/documentation/ARKit>.

## Topics

### Creating an anchoring component

[`init(_:)`](/documentation/RealityKit/AnchoringComponent/init(_:))

Creates an anchoring component with the given AR anchor.

[`init(_:trackingMode:)`](/documentation/RealityKit/AnchoringComponent/init(_:trackingMode:))

[`init(_:trackingMode:physicsSimulation:)`](/documentation/RealityKit/AnchoringComponent/init(_:trackingMode:physicsSimulation:))

Creates an anchoring component for a given target, tracking mode and physics simulation.

### Configuring the anchor

[`target`](/documentation/RealityKit/AnchoringComponent/target-swift.property)

The real world anchor target to attach the entity to.

[`trackingMode`](/documentation/RealityKit/AnchoringComponent/trackingMode-swift.property)

Defines how the `Entity` tracks its target anchor.

[`physicsSimulation`](/documentation/RealityKit/AnchoringComponent/physicsSimulation-swift.property)

Specifies the physics simulation spece that the entity and its descendants are in.

### Anchor targets

[`AnchoringComponent.Target`](/documentation/RealityKit/AnchoringComponent/Target-swift.enum)

Defines the kinds of real world objects to which an anchor entity can be tethered.

[`AnchoringComponent.TrackingMode`](/documentation/RealityKit/AnchoringComponent/TrackingMode-swift.struct)

Options for how an entity tracks its target anchor.

[`AnchoringComponent.PhysicsSimulation`](/documentation/RealityKit/AnchoringComponent/PhysicsSimulation-swift.enum)

Describes the physics simulation space of the entity and its descendants.



---

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)