Colocation
Two people in the same room, each in a headset, playing on the same real table. Colocation lines their headsets up so that shared content sits in the same real place for both: a board on the table is on the table for each of them, and a piece one moves is where the other sees it move.
It's for mixed reality projects with multiplayer on.
Setting it up
- Turn multiplayer on in the Environment panel.
- Select the XR Rig, then Add Component → Multiplayer → XR Multiplayer, and turn on Colocation.
- Put shared content around the origin. After calibrating, the origin is halfway between the two points the players touch, and +X runs from the first point to the second.
- Make the pieces shared (Share With Players) and grabbable (XR Interactable).
When a passthrough session starts, each player is asked to touch two points: "Touch the first corner with a fingertip and pinch", then the second. With controllers, touch with the controller's tip and pull the trigger. Both players touch the same two points in the same order: say the near-left then near-right corner of the table. Hold still for a moment while pinching; a shaky pinch is refused and asked again.
To calibrate again at any time, pinch with both hands and hold for a second and a half. Touching the same points again averages the tries, so each one makes it steadier. Touching different points starts over.
Checking it
- The other player's outline lines up with them. In passthrough each player is drawn as a ring at the head and dots on the fingertips. When calibration is good these sit on the real person. If the ring floats beside their head, calibrate again.
- Their points land on yours. Each player's two points are sent to the others and shown as coloured dots, through your own calibration. They should sit on the corners you touched.
- The distances are compared. Each headset measures how far apart the two points are. If those differ by more than 3 cm, both players are told ("Your points are 80 cm apart, Kofi's are 86 cm"), because it means they touched different points.
- Show a point.
this.network.colocation.showNextPoint()sends the next pinch to the others as a marker, so you can point at a real spot and ask "is it here for you?"
From a script
import { Behaviour } from "@relu-interactives/spatial-ecs";
export class CalibrateButton extends Behaviour {
// wire to a Spatial UI button
press() {
this.network?.colocation?.start();
}
protected onUpdate() {
const status = this.network?.colocation?.status;
if (status?.state === "done" && status.peers.some((peer) => peer.agrees === false)) {
console.log(status.message); // say it on a panel instead
}
}
}status has the state (off, first, second, done), the line to show the player, whether it's applied in the headset, how many tries were averaged, the measured distance, an error estimate (position in metres, headingDegrees), and what each other player measured.
How it works, and its limits
WebXR has no shared anchors between devices: each headset starts its own coordinate space wherever it was when the session began. But every headset agrees on which way is up, so only a turn and an offset separate two players' spaces, and two points both players touch pin down both. The engine offsets the headset's reference space (getOffsetReferenceSpace) so the shared frame is where world space starts. Everything in world space then agrees between players with nothing else changing: heads, hands, grabbed objects, the room scan, hit tests.
- It's as good as the touching. A centimetre off at each point, 50 cm apart, turns the heading by about 2°, which moves something a metre away by 4 cm. Points further apart give a steadier heading; the engine refuses two closer than
minPointDistance(30 cm). - Each session starts again. A headset's space belongs to one session, so taking the headset off, or leaving and entering again, asks for the points again.
- Tracking drifts a little. Over a long session a headset's sense of the room shifts by a centimetre or two. Calibrating again fixes it.
- The floor isn't shared. The origin sits at the height of the points touched, so content at y = 0 sits on the table. Each headset still has its own floor below that.
- Without a headset session (a desktop test window), the calibration is worked out and sent, but there's nothing to apply it to.
Why not a printed marker, or shared anchors?
- A printed marker would need the camera. WebXR's
camera-accessfeature (Raw Camera Access) exists in Chrome on Android phones, but Quest Browser rejects it (still in early 2026, on Horizon OS v85). Some Quest Browser versions have offered the passthrough camera throughgetUserMediaas an experiment, to some accounts only. Until a headset browser gives web pages the camera, a marker can't work there. - Shared spatial anchors exist in Meta's native SDK, not on the web. WebXR anchors are per device, and Quest's persistent anchors are only kept on the headset that made them.
Two touched points work on any WebXR headset with passthrough and need nothing printed.

