Contents

PortalFactory

A factory for creating portal entities with simplified configuration.

Declaration

enum PortalFactory

Overview

PortalFactory provides a convenient way to create complete portal setups by automatically configuring all necessary components including WorldComponent, ModelComponent with mesh and PortalMaterial, and PortalComponent with appropriate clipping and crossing modes.

The factory returns a PortalSetup containing a root entity with both the portal and world entities as children. Simply add the root entity to your scene to display the portal.

Example Usage

Create a simple flat portal:

let setup = PortalFactory.createPortal(
    style: .plane(width: 2.0, height: 1.5)
)
content.add(setup.rootEntity)

// Add content to the portal world
let sphere = ModelEntity(mesh: .generateSphere(radius: 0.3), materials: [SimpleMaterial()])
setup.worldEntity.addChild(sphere)

Topics

Creating a portal

Configuring the portal

See Also

Portals, clipping, and occlusion