Contents

makePortal(surfaceStyle:boundaryStyle:boundaryMode:)

Creates a portal entity and a world entity, and configures them.

Declaration

static func makePortal(surfaceStyle: PortalComponent.SurfaceStyle, boundaryStyle: PortalComponent.BoundaryStyle = .infinitePlane(), boundaryMode: PortalComponent.BoundaryMode = .disabled) -> PortalComponent.Portal

Parameters

  • surfaceStyle:

    The size of the portal surface mesh.

  • boundaryStyle:

    The shape of the clipping and crossing boundary. Defaults to Infiniteplane().

  • boundaryMode:

    The combination of clipping and crossing behaviors to enable. Defaults to Disabled.

Return Value

A PortalComponent.Portal containing the new portal entity and world entity.

Discussion

This is the simplest way to set up a portal. The returned PortalComponent.Portal value contains a fresh portal entity and a fresh world entity that you add to your scene. To add portal world content, parent it under the returned worldEntity.

let portal = PortalComponent.makePortal(
    surfaceStyle: .init(width: 0.5, height: 0.5),
    boundaryStyle: .infinitePlane(),
    boundaryMode: .clippingAndCrossing
)

content.add(portal.worldEntity)
content.add(portal.portalEntity)

To configure entities you already own — for example, a portal entity that has gesture components, or a world entity that’s already in your scene hierarchy — use configure(world:portalEntity:surfaceStyle:boundaryStyle:boundaryMode:) instead.