Skip to content

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.

  • Both move the main camera, or the character it follows, by the Camera::relocate rule in Camera director.
  • Their events reach scripts through a Signal Emitter on their own entity.
  • 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.

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.

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.

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.
Event Constant Data When
SpotPoint::occupied EventType.SpotPoint.Occupied none Someone arrived.
SpotPoint::release EventType.SpotPoint.Release none They left, or the reservation was released.

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.
  • Walking in. Each frame, the in portals 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 an in portal 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 out portal standing inside an in portal never loops.
  • Arriving. The player lands on the out portal facing its forward.
  • Several out portals on one channel take arrivals in turn, skipping any that are off. With none, nothing happens and the console warns once.
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.
Event Constant Data When
TravelPoint::enter EventType.TravelPoint.Enter none Sent by the in portal when it sends the player on.
TravelPoint::arrive EventType.TravelPoint.Arrive none Sent by the out portal when the player lands.
GuidedTour.jx
#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 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.

Seats.jx
#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();
}
});
}

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.

PortalGate.jx
#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 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.

1. A menu button that sends the player through a portal

Section titled “1. A menu button that sends the player through a portal”
FastTravel.jx
#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.

  • 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 out portal 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 in portal 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.