how do i add a portal in visionOS?

Asked on 08/02/2024

1 search

To add a portal in visionOS, you can use the RealityKit APIs. Here are the steps to get started:

  1. Set Up the Portal Component: You need to set up the portal component and define the crossing mode. You can set the mode to a plane to enable crossing or set it to disabled to disable crossing. Ensure that the plane coincides with the portal geometry itself.

  2. Enable Portal Crossing: This feature allows objects to smoothly cross the portal surface. For example, in a game, you can have spaceships or other objects move in and out of the portal seamlessly.

  3. Lighting Configuration: When an object is inside the portal, it can be lit by a custom image-based light component. When it is outside, it receives additional lighting from an environment probe. You can use an environment lighting configuration component to control the lighting transition smoothly.

For a detailed implementation, you can refer to the session Discover RealityKit APIs for iOS, macOS and visionOS starting at 20:17.

Relevant Sessions

These sessions provide comprehensive guidance on designing and implementing portals in visionOS.