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

# PortalCrossingComponent

A component that allows entities to cross portal boundaries.

```
struct PortalCrossingComponent
```

## Overview

Set this component on an entity inside the portal world to opt that entity — and its
descendants — into the portal’s crossing behavior. RealityKit then renders parts of the entity
inside the portal as portal content and parts outside in the host scene.

Crossing-eligible entities cross the boundary configured by
[`crossingMode`](/documentation/RealityKit/PortalComponent/crossingMode-swift.property) on the portal entity:

- With [`PortalComponent.CrossingMode.plane(_:)`](/documentation/RealityKit/PortalComponent/CrossingMode-swift.enum/plane(_:)), entities cross an infinite plane.
- With [`PortalComponent.CrossingMode.volume(_:)`](/documentation/RealityKit/PortalComponent/CrossingMode-swift.enum/volume(_:)), entities cross the faces of a box.

The component has no configurable state; its presence on an entity is what enables crossing.

### Inheritance

[`PortalCrossingComponent`](/documentation/RealityKit/PortalCrossingComponent) propagates down the entity hierarchy. Setting it on an ancestor
makes every descendant crossing-eligible without setting it on each one individually:

```swift
let world = Entity()
world.components.set(WorldComponent())

let group = Entity()
group.components.set(PortalCrossingComponent())

let body = Entity()
let head = Entity()
group.addChild(body)
group.addChild(head)

world.addChild(group)
// `body` and `head` both cross the portal because their ancestor `group` opts in.
```

An entity isn’t crossing-eligible if no ancestor in its chain (including itself) has
[`PortalCrossingComponent`](/documentation/RealityKit/PortalCrossingComponent), if [`isEnabled`](/documentation/RealityKit/Entity/isEnabled) is `false` on any ancestor in the chain,
or if it isn’t a descendant of an entity with [`WorldComponent`](/documentation/RealityKit/WorldComponent).

See [`PortalComponent`](/documentation/RealityKit/PortalComponent) for an end-to-end portal setup.

---

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)