Tutorial: Create a Portal

Portals in High Fidelity transport you to the domain of your choice. You can use these portals to travel to a domain you visit frequently instead of using the GoTo app on your HUD or Tablet.

On This Page:

Prerequisites

Consider getting familiar with the following concepts before starting this tutorial:

Write a Script for the Portal

A portal is an entity with a script attached (entity script). This attached script defines what happens when a user comes in contact with the portal. We’ve used portal.js, the script used to teleport in High Fidelity domains. You can also write your own script to suit your needs.

The portal.js script we’ve used:

  • Uses High Fidelity’s JavaScript API to determine when a user walks into the entity and the teleport destination.
  • Includes a sound that will played every time a user uses the portal.
  • Teleports a user to the specified destination.

Create and Edit an Entity to Use as a Portal

Any entity you create to be used as a portal has to be collisionless so that the script can detect when you walk into the entity.

  1. In Interface, pull up your HUD or Tablet and go to Create.
  2. Create an entity to be used as a portal. This can be a 3D model or a box or sphere entity.
  3. Go to the ‘Properties’ tab and scroll down to ‘Behavior’.
  4. Next to ‘Script’, paste the script URL. In this case, it is ‘portal.js’.
  5. The script takes the location you want to teleport to from the ‘User Data’ field under ‘Behavior’.
  6. Add hifi:// welcome (High Fidelity’s welcome domain) to the ‘User Data’ field.
  7. Scroll down to ‘Collision’ and uncheck ‘Collides’. This is so that a user can walk into the entity and trigger the script.
  8. Exit Create mode and walk into the entity.

You will be teleported to High Fidelity’s welcome domain.

See Also