{"_id":"5c12c252ccfacf00f9af20fe","project":"5a065a6134873d0010b396ab","version":{"_id":"5c12c252ccfacf00f9af2106","project":"5a065a6134873d0010b396ab","__v":0,"forked_from":"5bec8a59a9db0c0012d54110","createdAt":"2018-04-18T18:19:34.288Z","releaseDate":"2018-04-18T18:19:34.288Z","categories":["5c12c252ccfacf00f9af20ca","5c12c252ccfacf00f9af20cb","5c12c252ccfacf00f9af20cc","5b05923ea5a2f9000357b452","5b05f793c2c86c0003cbe414","5c12c252ccfacf00f9af20cd","5c12c252ccfacf00f9af20ce","5c12c252ccfacf00f9af20cf"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.13.0","version":"1.13.0"},"category":{"_id":"5c12c252ccfacf00f9af20cd","project":"5a065a6134873d0010b396ab","version":"5c12c252ccfacf00f9af2106","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2018-05-24T14:09:29.251Z","from_sync":false,"order":2,"slug":"develop-ar","title":"Augmented Reality"},"user":"579a69d53de0a217007eda56","githubsync":"","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2018-05-24T14:11:06.071Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"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.\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/e60e769-portal360.gif\",\n \"portal360.gif\",\n 300,\n 534,\n \"#534643\"\n ]\n }\n ]\n}\n[/block]\n[PortalScene](https://developer.viromedia.com/virocore/reference/com/viro/core/PortalScene.html) 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.\n\nThe following example shows how to create a simple Portal that transports you from your current location to a beach-like resort.\n[block:code]\n{\n \"codes\": [\n {\n \"code\": \"// Add a Light so the ship door portal entrance will be visible\\nOmniLight light = new OmniLight();\\nlight.setColor(Color.WHITE);\\nlight.setPosition(new Vector(0, 1, -4 ));\\nscene.getRootNode().addLight(light);\\n\\n// Load a model representing the ship door\\nObject3D shipDoorModel = new Object3D();\\nshipDoorModel.loadModel(Uri.parse(\\\"file:///android_asset/portal_ship.vrx\\\"), Object3D.Type.FBX, null);\\n\\n// Create a Portal out of the ship door\\nPortal portal = new Portal();\\nportal.addChildNode(shipDoorModel);\\nportal.setScale(new Vector(0.5, 0.5, 0.5));\\n\\n// Create a PortalScene that uses the Portal as an entrance.\\nPortalScene portalScene = new PortalScene();\\nportalScene.setPosition(new Vector(0, 0, -5));\\nportalScene.setPortalEntrance(portal);\\n\\n// Add a 'beach' background for the Portal scene\\nfinal Bitmap beachBackground = getBitmapFromAssets(\\\"beach.jpg\\\");\\nfinal Texture beachTexture = new Texture(beachBackground, Texture.Format.RGBA8, true, false);\\nportalScene.setBackgroundTexture(beachTexture);\\n\\nscene.getRootNode().addChildNode(portalScene);\",\n \"language\": \"java\"\n }\n ]\n}\n[/block]\nTo try this example, you can download the beach 360 photo and portal ship door assets [here](http://dq0qxqxzgyp27.cloudfront.net/virocore/readme_example_assets/portal_example_assets.zip). Unzip these and store in your applications assets folder. The resulting scene is shown below.\n[block:image]\n{\n \"images\": [\n {\n \"image\": [\n \"https://files.readme.io/936de76-portal2.png\",\n \"portal2.png\",\n 1440,\n 2560,\n \"#685640\"\n ]\n }\n ]\n}\n[/block]","excerpt":"","slug":"ar-portals","type":"basic","title":"Portals"}