GuidesReferenceIssuesSupportGet API Key

Portals are an AR effect where a 'window' or 'door' is displayed that users can use to peer into a virtual world, as shown below.

PortalScene is the root of the subgraph of Nodes that is displayed through a Portal. Each PortalScene can contain any number of child nodes and content, and each PortalScene can have its own background texture. If a PortalScene is set to passable, users are able to walk through the Portal into the PortalScene.

The following example shows how to create a simple Portal that transports you from your current location to a beach-like resort.

// Add a Light so the ship door portal entrance will be visible
OmniLight light = new OmniLight();
light.setPosition(new Vector(0, 1, -4 ));

// Load a model representing the ship door
Object3D shipDoorModel = new Object3D();
shipDoorModel.loadModel(Uri.parse("file:///android_asset/portal_ship.vrx"), Object3D.Type.FBX, null);

// Create a Portal out of the ship door
Portal portal = new Portal();
portal.setScale(new Vector(0.5, 0.5, 0.5));

// Create a PortalScene that uses the Portal as an entrance.
PortalScene portalScene = new PortalScene();
portalScene.setPosition(new Vector(0, 0, -5));

// Add a 'beach' background for the Portal scene
final Bitmap beachBackground = getBitmapFromAssets("beach.jpg");
final Texture beachTexture = new Texture(beachBackground, Texture.Format.RGBA8, true, false);


To try this example, you can download the beach 360 photo and portal ship door assets here. Unzip these and store in your applications assets folder. The resulting scene is shown below.