Spot Point
Updated
Marks a spot in the world that gameplay systems can find and send the player to.
- Type
ent-spot-point- Script class
SpotPointEntity- Family
- Navigation
Overview
Section titled “Overview”A Spot Point is a click-to-go destination. In play, it shows a marker (a pin, a star, an orb…), and clicking that marker, or any mesh placed under the spot point, moves the player onto it at once. Scripts can send the player there too, with travel(). It suits galleries, showrooms, guided tours and touch screens, where walking is slow or awkward. In the editor it shows the marker and an arrow for the arrival facing, and clicking it does nothing.
Like the other navigation points, it moves the main camera, or the character that camera follows; in an immersive session it moves the player rig. Each player moves only themselves: nothing is sent over the network.
Pick a sibling for other jobs: a Spawn Point places players when they join, and a Travel Point is a portal that sends whoever walks into it somewhere else.
The props that matter most:
appearanceis the marker:pin,star,diamond,orb,chevron,heart,info, orinvisible. Withinvisible, nothing is drawn in play; put your own model under the spot point and clicking it travels there.coloris the marker’s colour.facing:alignturns the player to the spot point’s own facing (its forward,-Z);keepleaves them facing the way they already were.ocupablereserves the point for whoever arrives. Nobody else can travel there until they walk farther thanradiusaway, and the marker hides while it is taken.radiusis the area, in metres, held for whoever stands on the point. It scales with the entity.
A new Spot Point also carries a Billboard with lockY, which turns only its marker toward the camera, never the arrival facing.
Set it up
Section titled “Set it up”- Add a Spot Point entity to the scene where the player should stand. See Scenes and hierarchy.
- Rotate it so its arrow points at what the player should see on arrival, and keep
facingonalign. - Choose an
appearanceand acolorfor the marker, or setappearancetoinvisibleand place your own model under it. - Leave
ocupableon for seats and viewing spots that hold one person; turn it off for places anyone can use at any time. - To react from a script, add a Signal Emitter to the spot point and give it a signal name.
Examples
Section titled “Examples”Travel from a menu button
Section titled “Travel from a menu button”Send the player to a named spot point when a UI button is pressed.
#pragma lifecycle(startup)
function startup() { // The 'Stage' button has a Signal Emitter with the signal 'menu/stage'. const stage = findEntity('Stage Spot')?.getComponent(SpotPointComponent);
on('menu/stage', (event) => { if (event.eventType !== EventType.UIButton.Press) return; if (!stage || !stage.travel()) log('The stage spot is taken or unavailable'); });}How it works:
getComponent(SpotPointComponent)reaches the Spot Point component, which ownstravel().travel()moves the player at once and returnstrue. It returnsfalsein the editor, while the point is off, without a camera, or while someone else holds it.- The button’s events arrive as
{ entityId, eventType, data }; the check keeps onlyEventType.UIButton.Press.
An automatic guided tour
Section titled “An automatic guided tour”Move the player through a list of stops, pausing at each one, and announce every arrival.
#pragma lifecycle(startup)
const STOPS = ['Stop Entrance', 'Stop Sculpture', 'Stop Window', 'Stop Exit'];const PAUSE = 8000; // milliseconds at each stoplet index = 0;let cancelNext = null;
function visit() { const point = findEntity(STOPS[index])?.getComponent(SpotPointComponent); if (point && point.travel()) emit('tour/stop', { name: STOPS[index], number: index + 1 }); index += 1; cancelNext = index < STOPS.length ? delay(visit, PAUSE) : null;}
function startup() { on('tour/start', () => { if (cancelNext) cancelNext(); index = 0; visit(); }); on('tour/stop-tour', () => { if (cancelNext) cancelNext(); cancelNext = null; });}How it works:
visit()travels to the current stop, announces it ontour/stop, then schedules the next stop withdelay, which returns a function that cancels it.- A stop that cannot be reached (taken, or switched off) is skipped instead of stopping the tour.
- Any button or script starts the tour with
emit('tour/start')and stops it withemit('tour/stop-tour'). A narration script can listen totour/stopto play the right commentary.
Unlock a viewpoint
Section titled “Unlock a viewpoint”Keep a special viewpoint hidden until the player earns it, then show it with a gold star.
#pragma lifecycle(startup)
function startup() { const viewpoint = findEntity('Rooftop Spot'); if (!viewpoint) return; viewpoint.setEnabled(false); // no marker, no clicks, travel() returns false
on('quest/complete', () => { viewpoint.setEnabled(true); viewpoint.getComponent(SpotPointComponent).setProps({ appearance: 'star', color: '#facc15' }); log('The rooftop viewpoint is open'); });
// The viewpoint has a Signal Emitter with the signal 'rooftop'. on('rooftop', (event) => { if (event.eventType === EventType.SpotPoint.Occupied) emit('music/rooftop'); if (event.eventType === EventType.SpotPoint.Release) emit('music/default'); });}How it works:
setEnabled(false)switches the whole entity off: its marker disappears and it cannot be travelled to.- When another script emits
quest/complete, the entity is switched on andsetPropschanges the marker to a gold star. SpotPoint::occupiedis sent when the player arrives andSpotPoint::releasewhen they leave or the reservation is released; the script switches the music with them.
- A marker is about a metre tall and solid: a wall or a model in front of it hides it and catches the click. Keep the line of sight clear.
- An
invisiblespot point with nothing under it can only be reached from a script withtravel(). - Reservation is local to each player’s device and is never saved. Do not rely on
ocupableto keep two players apart.
Components
Section titled “Components”What a new Spot 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. |
| Spot Point | comp- |
Required | One | Marks a spot in the world that gameplay systems can find and send the player to. |
| Billboard | comp- |
Starts with | One | Keeps the entity turned toward the camera, for sprites and labels. |
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({ … }).
Spot Point
Section titled “Spot Point”| Prop | Default | Range |
|---|---|---|
ocupable |
true |
|
facing |
"align" |
|
radius |
0.5 |
0. |
color |
"#38bdf8" |
|
appearance |
"pin" |
Billboard
Section titled “Billboard”| Prop | Default | Range |
|---|---|---|
lockY |
true |
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.
SpotPoint::occupiedSpotPoint::release
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.
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.
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 Spot Point.
#pragma lifecycle(startup)
function startup() { // Find the entity by the name it has in the Hierarchy. const entity = findEntity('My Spot Point'); if (!(entity instanceof SpotPointEntity)) return;
// Its Spot Point component holds the settings listed under Props. const component = entity.getComponent(SpotPointComponent); log('radius is', component.props.radius); component.setProps({ radius: 0.75 });}