Travel Point
Updated
Walking into an in portal sends the player to an out portal of the same channel.
- Type
ent-travel-point- Script class
TravelPointEntity- Family
- Navigation
Overview
Section titled “Overview”A Travel Point is a portal. Walking into an in portal sends the player to an out portal on the same channel, where they land facing the out portal’s forward. In play, each portal shows an upright ring: cyan for in, amber for out. In the editor it shows the ring and a ground marker, and sends no one.
A player who is already inside an in portal, or who lands inside one, must step out before it sends them again, so an out portal standing inside an in portal never loops. Scripts can also send the player through an in portal at once with travel(), exactly as walking in would. Each player moves only themselves: nothing is sent over the network.
Choose a Travel Point when moving somewhere should feel like walking through a door. For a destination the player clicks, use a Spot Point; for where players appear when they join, use a Spawn Point.
The props that matter most:
port:insends whoever walks into it on;outis where they arrive.channelpairs portals. An in portal sends the player to an out portal with the same channel name. Several out portals on one channel take arrivals in turn, skipping any that are off.radius: on an in portal, the trigger, a cylinder that reaches from half a unit below the point to two and a half above; on an out portal, the arrival pad. It scales with the entity.appearance:portalshows the ring in play;invisibleshows nothing, so you can dress the portal with your own model while it still works.colorrecolours the ring. Empty uses the port’s own colour.
Set it up
Section titled “Set it up”- Add a Travel Point entity where the player should leave, and keep its
portonin. See Scenes and hierarchy. - Add a second Travel Point where the player should arrive, set its
porttoout, and rotate it so its forward points the way the player should face. - Give both the same
channel, such asvault. Use a different channel for every other pair of portals. - Adjust
radiusso the in portal’s trigger covers the doorway, and pick anappearanceandcolor. - To react from a script, add a Signal Emitter to either portal: the in portal sends
TravelPoint::enter, the out portalTravelPoint::arrive.
Examples
Section titled “Examples”Announce an arrival
Section titled “Announce an arrival”Show a message and change the music when the player comes out of a portal.
#pragma lifecycle(startup)
function startup() { // The out portal has a Signal Emitter with the signal 'portal/garden'. on('portal/garden', (event) => { if (event.eventType !== EventType.TravelPoint.Arrive) return; emit('hud/toast', { text: 'You reached the Secret Garden' }); emit('music/garden'); });}How it works:
- The out portal sends
TravelPoint::arrivethrough its Signal Emitter when the player lands on it. - The event carries no data;
event.entityIdtells which portal sent it when several share a signal. - The script republishes plain signals,
hud/toastandmusic/garden, that the HUD and music scripts listen to.
A portal that opens with a key
Section titled “A portal that opens with a key”Keep a portal closed until the player collects a key, then light it up.
#pragma lifecycle(startup)
function startup() { const gate = findEntity('Vault Portal In')?.getComponent(TravelPointComponent); if (!gate) return; gate.setEnabled(false); // closed: no ring, no trigger
on('key/collected', () => { gate.setEnabled(true); gate.setProps({ color: '#facc15' }); log('The vault portal is open'); });}How it works:
- A disabled Travel Point component neither shows nor sends anyone, and its
travel()returnsfalse. - When another script emits
key/collected,setEnabled(true)opens the portal andsetPropsrecolours its ring gold.
One doorway, many destinations
Section titled “One doorway, many destinations”Let a lever choose where a single in portal leads, by changing its channel.
#pragma lifecycle(startup)
const CHANNELS = ['harbour', 'castle', 'forest'];let choice = 0;
function startup() { // Out portals with these channels stand in each area. const door = findEntity('Hub Portal')?.getComponent(TravelPointComponent); if (!door) return; door.setProps({ channel: CHANNELS[choice] });
// The lever has a Selectable and a Signal Emitter with the signal 'lever'. on('lever', (event) => { if (event.eventType !== EventType.Selectable.Select) return; findEntity(event.entityId)?.getComponent(SelectableComponent)?.setSelected(false); // so the next click selects it again choice = (choice + 1) % CHANNELS.length; door.setProps({ channel: CHANNELS[choice] }); emit('hud/toast', { text: `The portal now leads to the ${CHANNELS[choice]}` }); });}How it works:
- Each area has an out portal with its own channel:
harbour,castle,forest. - Clicking the lever moves to the next channel;
setProps({ channel })makes the hub’s in portal lead there from the next crossing. - A channel is any non-empty name, so it can be built from game state.
A fast-travel menu
Section titled “A fast-travel menu”Send the player through a portal from a UI menu, without walking to it.
#pragma lifecycle(startup)
const PORTALS = { harbour: 'Portal To Harbour', castle: 'Portal To Castle' };
function startup() { // Menu buttons emit 'travel/go' with { place: 'harbour' } or { place: 'castle' }. on('travel/go', (data) => { const portal = findEntity(PORTALS[data.place] ?? '')?.getComponent(TravelPointComponent); if (!portal || !portal.travel()) log('Cannot travel to', data.place); });}How it works:
travel()on an in portal does exactly what walking into it does, so the same portals serve walkers and the menu.- It returns
falsefrom an out portal, in the editor, while the portal is off, or when no out portal shares its channel. datais the object passed toemit, because this signal comes from a script and not from a Signal Emitter.
- A portal that never fires usually has no out portal on the same channel, or the player started inside it. Players must walk in from outside.
- Place the out portal’s pad on open ground, clear of the in portal’s trigger, so arrivals have room to step away.
- Portals run only in play. To test one, enter play and walk through it.
Components
Section titled “Components”What a new Travel Point is made of. Required components are always present and cannot be removed; the others can. Per entity says whether an entity can hold one of that component or several. Layer, Lock and Enable are on every placed entity, and Transform holds its position, rotation and scale.
| Component | Type | Role | Per entity | What it does |
|---|---|---|---|---|
| Layer | comp-layer |
Required | One | Puts the entity on a render/raycast layer so cameras and rays can include or skip it. |
| Lock | comp-lock |
Required | One | Editor-only flag that stops the entity from being selected or moved. |
| Enable | comp-enable |
Required | One | Turns the entity and its children on or off: hides them and stops their behavior. |
| Transform | comp- |
Required | One | Position, rotation and scale of the entity, with optional editor-only per-axis locks. |
| Travel Point | comp- |
Required | One | Walking into an in portal sends the player to an out portal of the same channel. |
You can also add 1 optional components, such as Signal Emitter.
The settings of a new entity, as the runtime creates it. Change them in the Properties panel of XR Creator, or from a script with getComponent(…).setProps({ … }).
| Prop | Default | Range |
|---|---|---|
port |
"in" |
|
channel |
"main" |
|
radius |
0.6 |
0. |
color |
"" |
|
appearance |
"portal" |
Events
Section titled “Events”With a Signal Emitter on the entity, these events reach scripts as { entityId, eventType, data }. Compare eventType with the EventType constants.
TravelPoint::enterTravelPoint::arrive
Like every entity, it also reports: Transform::change (and position-change, rotation-change, scale-change), Enable::change, Layer::change and Lock::change.
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
A Travel Point into the vault stays closed until you press Pick up the key; then it opens with a gold ring, and walking into it lands you on the vault's out portal, which reports your arrival.
Press Pick up the key, then walk forward with W into the gold ring to travel to the vault. Drag to look around.
From a script
Section titled “From a script”Find the entity by its name, check its class, and work with its components. Name the entity in the Hierarchy first; this example expects My Travel Point.
#pragma lifecycle(startup)
function startup() { // Find the entity by the name it has in the Hierarchy. const entity = findEntity('My Travel Point'); if (!(entity instanceof TravelPointEntity)) return;
// Its Travel Point component holds the settings listed under Props. const component = entity.getComponent(TravelPointComponent); log('radius is', component.props.radius); component.setProps({ radius: 0.9 });}