configure(world:portalEntity:surfaceStyle:boundaryStyle:boundaryMode:)
Configures an existing pair of entities as a portal and its target world.
Declaration
static func configure(world: Entity, portalEntity: Entity, surfaceStyle: PortalComponent.SurfaceStyle, boundaryStyle: PortalComponent.BoundaryStyle = .infinitePlane(), boundaryMode: PortalComponent.BoundaryMode = .disabled)Parameters
- world:
The entity that contains the portal’s content. Place portal world descendants under this entity.
- portalEntity:
The entity that displays the portal surface in the host scene.
- 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.
Discussion
This method writes a coordinated set of components onto the two entities you provide. Use it when you already own both entities — for example, when the portal entity holds gestures or other components, or when the world entity is a child of an existing scene.
On the world entity, this method sets:
On the portal entity, this method sets:
ModelComponent with a flat plane mesh sized by
surfaceStyle, applied with PortalMaterialPortalComponent with clippingMode and crossingMode configured from
boundaryStyleandboundaryMode
This method replaces any existing WorldComponent, ModelComponent, or PortalComponent on the entities. Other components on either entity are preserved.
To create both entities at once, use makePortal(surfaceStyle:boundaryStyle:boundaryMode:) instead.