Spot and travel points
Updated
Spot Points and Travel Points send the player somewhere during play, without walking. A Spot Point is a click-to-go destination: the player clicks its marker (or a script calls travel()) and stands on it. It suits galleries, showrooms and touch screens, where walking is awkward. A Travel Point is a portal: walking into an in portal sends the player to an out portal on the same channel. Both differ from spawn points, which place the player when they join.
Before you start
Section titled “Before you start”- Both move the main camera, or the character it follows, by the
Camera::relocaterule in Camera director. - Their events reach scripts through a Signal Emitter on their own entity.
How the player moves
Section titled “How the player moves”- On desktop and mobile they move the main camera. When its controller follows a character, the character is placed there and the camera comes along; otherwise the camera stands there, its eyes above the point. Then the camera’s controller takes over.
- In immersive XR they move the XR rig, or the body of the Character Controller carrying it.
- A Character Controller, NavMesh Agent or rigid body is placed through its own API, so it does not snap back.
- Each client moves only its own player; nothing is sent over the network. They act only in play.
Spot Point
Section titled “Spot Point”A Spot Point is an entity (ent-spot-point) with a comp-spot-point. Place and rotate it with its transform: its forward (-Z) is the facing the player arrives with. A new Spot Point also has a Billboard, which turns only its marker toward the camera.
In play, clicking the marker, or any mesh under the spot point’s entity, travels there.
| Prop | Type | Default | Description |
|---|---|---|---|
ocupable |
boolean | true |
Reserve the point for whoever arrives. See Reservation. |
facing |
'align' or 'keep' |
'align' |
align turns the player to the point’s facing; keep keeps the way they already faced. |
radius |
number | 0.5 |
The area held for whoever stands on the point, in world units. Scales with the entity. |
appearance |
string | 'pin' |
The marker: 'pin', 'star', 'diamond', 'orb', 'chevron', 'heart', 'info' or 'invisible'. |
color |
string | '#38bdf8' |
The marker’s colour. Any CSS colour. |
With appearance: 'invisible', nothing is drawn in play: put your own model or primitive under the spot point, and clicking it travels there. With nothing under it, an invisible spot point is for scripts only. Markers are about a metre tall and solid: what stands in front of them hides them.
Reservation
Section titled “Reservation”With ocupable: true, the point is reserved for whoever arrives. Nobody else can travel there until the occupant moves farther than radius away, is deactivated or leaves. While it is occupied, its marker hides. The reservation is local to each client and is never saved.
Scripting
Section titled “Scripting”| Member | What it does |
|---|---|
travel() |
Send the player here now. Returns false in the editor, while the point is off or inactive, without a camera, or while someone else holds it. Works whatever its appearance. |
occupied |
Whether whoever travelled here still stands on it. Read-only. |
release() |
Release the reservation now. |
Events
Section titled “Events”| Event | Constant | Data | When |
|---|---|---|---|
Spot |
Event |
none | Someone arrived. |
Spot |
Event |
none | They left, or the reservation was released. |
Travel Point
Section titled “Travel Point”A Travel Point is an entity (ent-travel-point) with a comp-travel-point. Place and turn it with its transform, then set its port and channel.
| Prop | Type | Default | Description |
|---|---|---|---|
port |
'in' or 'out' |
'in' |
in sends whoever walks into it on; out is where they arrive. |
channel |
string | 'main' |
In and out portals pair by channel. A non-empty name. |
radius |
number | 0.6 |
On an in portal, the trigger: a cylinder of this radius from half a unit below the point to two and a half above. On an out portal, the arrival pad. |
color |
string | '' |
The ring’s colour. Empty uses the port’s own: cyan for in, amber for out. |
appearance |
'portal' or 'invisible' |
'portal' |
portal shows an upright ring in play. invisible shows nothing, so you can give it your own look while it still works. |
How portals work
Section titled “How portals work”- Walking in. Each frame, the
inportals look for the player: in VR the headset, otherwise the character the main camera follows, or the camera itself. A player who crosses from outside to inside aninportal is sent on. - Stepping out first. A player already inside when the portal starts, or who lands inside one, must step out before it sends them, so an
outportal standing inside aninportal never loops. - Arriving. The player lands on the
outportal facing its forward. - Several
outportals on one channel take arrivals in turn, skipping any that are off. With none, nothing happens and the console warns once.
Scripting
Section titled “Scripting”| Member | What it does |
|---|---|
travel() |
Send the player through this in portal now, as walking in would. Returns false from an out portal, in the editor, while off, or with no out portal on its channel. |
Events
Section titled “Events”| Event | Constant | Data | When |
|---|---|---|---|
Travel |
Event |
none | Sent by the in portal when it sends the player on. |
Travel |
Event |
none | Sent by the out portal when the player lands. |
Examples
Section titled “Examples”1. A guided tour of spot points
Section titled “1. A guided tour of spot points”#pragma lifecycle(startup, update)
const STOPS = ['Stop Entrance', 'Stop Sculpture', 'Stop Window', 'Stop Exit'];let points;let current = -1;
function startup() { points = STOPS.map((name) => findEntity(name)?.getComponent(SpotPointComponent));}
function update() { let step = 0; if (Input.keyboard.isKeyReleased(Key.ArrowRight)) step = 1; if (Input.keyboard.isKeyReleased(Key.ArrowLeft)) step = -1; if (step === 0) return;
const next = Math.min(STOPS.length - 1, Math.max(0, current + step)); if (points[next]?.travel()) { current = next; log('Tour stop', current + 1, 'of', STOPS.length); }}The arrow keys walk the player along four Spot Points with travel(); each stop is aligned so the player faces what is there to see.
Click the scene, then press the right arrow to go to the next stop and the left arrow to go back. Drag to look around.
The script collects the Spot Point components once, then moves along the list with the arrow keys. travel() returns false when a stop is taken or switched off, and the script only advances current when the move succeeded. Set the stops’ facing to align so each one turns the player toward what they should see.
2. Hold a seat and show who is sitting
Section titled “2. Hold a seat and show who is sitting”#pragma lifecycle(startup)
function startup() { let taken = 0; on('seats', (event) => { if (event.eventType === EventType.SpotPoint.Occupied) taken += 1; if (event.eventType === EventType.SpotPoint.Release) taken -= 1; const seat = findEntity(event.entityId); log(seat?.name, event.eventType === EventType.SpotPoint.Occupied ? 'taken' : 'free', `(${taken} seated)`); });
on('seats/stand', () => { for (const name of ['Seat 1', 'Seat 2', 'Seat 3']) { const seat = findEntity(name)?.getComponent(SpotPointComponent); if (seat?.occupied) seat.release(); } });}Three spot points act as seats: clicking a marker travels there and reserves it, and a script counts the occupied and release events they share on one signal.
Click a seat marker to sit there, then another. Watch the script log.
With ocupable on, each seat is reserved while someone sits on it and its marker hides. The seats share one signal, and event.entityId says which one changed. The stand-up button releases any seat this client holds, which shows the marker again.
3. Open a portal when a key is collected
Section titled “3. Open a portal when a key is collected”#pragma lifecycle(startup)
function startup() { const portal = findEntity('Vault Portal In'); const gate = portal.getComponent(TravelPointComponent); gate.setEnabled(false); // closed until the key is found
on('key/collected', () => { gate.setEnabled(true); gate.setProps({ color: '#facc15' }); log('The vault portal is open'); });
on('vault-exit', (event) => { if (event.eventType === EventType.TravelPoint.Arrive) emit('music/vault'); });}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.
A disabled in portal neither shows nor sends anyone. When the key is collected the script enables it and recolours its ring gold. The out portal inside the vault sends TravelPoint::arrive when the player lands, which the script uses to switch the music.
Snippets
Section titled “Snippets”1. A menu button that sends the player through a portal
Section titled “1. A menu button that sends the player through a portal”#pragma lifecycle(startup)
const DESTINATIONS = { harbour: 'Portal To Harbour', castle: 'Portal To Castle' };
function startup() { // UI buttons emit 'travel/go' with { place: 'harbour' } or { place: 'castle' }. on('travel/go', (data) => { const portal = findEntity(DESTINATIONS[data.place] ?? '')?.getComponent(TravelPointComponent); if (portal?.travel() === false) log('Nowhere to go for', data.place); });}travel() on an in portal works exactly like walking into it, so the same portals serve both walkers and a fast-travel menu. It returns false when the portal is an out portal, is off, or has no out portal on its channel.
Common mistakes
Section titled “Common mistakes”- Clicking a spot point does nothing. It may be occupied by someone else, switched off, or hidden behind another mesh. Check
travel()’s return value from a script. - A portal that never fires. It needs an
outportal on the same channel, and the player must walk in from outside. - Expecting a portal to fire on arrival. A player who lands inside an
inportal must step out and walk back in before it sends them on. This is deliberate, so portals never loop. - Invisible spot point that cannot be clicked. Put a mesh under it, or call
travel()from a script. - Expecting reservations across players. Reservation is local to each client.