games + 3dxr

xr

openxr, hands, anchors, passthrough, moving without making people sick, and the headsets.

report a mistake
.md

openxr is one api between your app and the headset runtime: a session, a frame loop, spaces and actions. hands, anchors and passthrough are extensions on top.

checked against
openxr 1.1.65 with meta's openxr sdk v85 and the visionos 27 sdk
hand joints
26 in openxr. arkit on visionos has 27
snap turn
30, 45, 90° the angles to offer. the comfortable default
smooth turn
opt in a turn the inner ear can't feel. vignette it
reach for it
  • a native quest app, or your own engine
  • hands as input
  • content that stays put in a room
  • mixed reality over passthrough
  • moving people without making them sick
on this page
  1. openxr
  2. hand tracking
  3. spatial anchors
  4. passthrough
  5. locomotion + comfort
  6. quest / visionos basics
  7. pitfalls
  8. sources

xr covers vr, where a headset replaces the world, and ar and mixed reality, where it adds to it.1 this sheet is the native side: openxr, the khronos api a quest runs, then hand tracking, anchors and passthrough, how to move people without making them sick, and how to start on a quest or an apple vision pro. webxr, the same ideas in a browser, comes last.

it was checked against openxr 1.1.65, released 16 october 2026,2 meta’s openxr sdk v85,3 the visionos 27 sdk in xcode 27,4 and the webxr draft of 9 june 2026.5 the openxr code is c, the visionos code swift. api names and menus move between versions, so check yours against these.

openxr

openxr is the interface between an app and an xr runtime: the vendor’s software that tracks the headset, runs the devices and composites your frames onto the displays.1 a machine can have several runtimes installed, with one active at a time.6 the core api is the same everywhere. extensions add the rest, like hands and passthrough.

you make the objects in this order: an instance, which connects you to the runtime and turns on extensions; a system, the device, picked by form factor; a session, your app running on that system with one graphics api; then spaces to measure poses in, swapchains to render into, and actions for input.17

// first, ask what the runtime has: xrEnumerateInstanceExtensionProperties lists its extensions
// every call returns an XrResult: check each one with XR_FAILED(). left out to keep this short
const char *exts[] = {XR_KHR_VULKAN_ENABLE2_EXTENSION_NAME, XR_EXT_HAND_TRACKING_EXTENSION_NAME};
XrInstanceCreateInfo ici = {
  .type = XR_TYPE_INSTANCE_CREATE_INFO,
  .applicationInfo = {.applicationName = "hello", .apiVersion = XR_API_VERSION_1_1},
  .enabledExtensionCount = 2,
  .enabledExtensionNames = exts,
};
XrInstance instance;
xrCreateInstance(&ici, &instance);

XrSystemGetInfo sgi = {.type = XR_TYPE_SYSTEM_GET_INFO, .formFactor = XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY};
XrSystemId system;
xrGetSystem(instance, &sgi, &system);

// call xrGetVulkanGraphicsRequirements2KHR first, then fill in your vulkan instance, device and queue
XrGraphicsBindingVulkan2KHR gpu = {.type = XR_TYPE_GRAPHICS_BINDING_VULKAN2_KHR};
XrSessionCreateInfo sci = {.type = XR_TYPE_SESSION_CREATE_INFO, .next = &gpu, .systemId = system};
XrSession session;
xrCreateSession(instance, &sci, &session);

// the floor under where the app started. the world goes in here
XrReferenceSpaceCreateInfo rci = {
  .type = XR_TYPE_REFERENCE_SPACE_CREATE_INFO,
  .referenceSpaceType = XR_REFERENCE_SPACE_TYPE_LOCAL_FLOOR,
  .poseInReferenceSpace = {.orientation = {.w = 1}},
};
XrSpace world;
xrCreateReferenceSpace(session, &rci, &world);

what trips people up:

the session

the runtime moves a session from state to state and tells you with events. you read them with xrPollEvent, and each XrEventDataSessionStateChanged carries the new state.1112

a diagram of the openxr session states, each box a state with what it means or what you call there. down the left is the way in, in cyan: idle, where you keep polling events; ready, where you call xrBeginSession and start the frame loop; synchronized, where your frames aren't shown yet; visible, where they show but input doesn't reach you; and focused, with frames and input. the way out is in amber: focus lost takes focused back to visible, and hidden takes visible back to synchronized. the runtime's stop takes synchronized to stopping, where you call xrEndSession, and the session goes back to idle. from idle, a finished session goes on to exiting, where you call xrDestroySession. loss pending can come from any state, and there too you call xrDestroySession, and maybe make a new session.

the runtime makes every move but two: you answer ready with xrBeginSession and stopping with xrEndSession.
// drain the queue every time around the loop
XrEventDataBuffer ev = {.type = XR_TYPE_EVENT_DATA_BUFFER};
while (xrPollEvent(instance, &ev) == XR_SUCCESS) {
  if (ev.type == XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED) {
    XrSessionState state = ((XrEventDataSessionStateChanged *)&ev)->state;
    if (state == XR_SESSION_STATE_READY) {
      XrSessionBeginInfo begin = {
        .type = XR_TYPE_SESSION_BEGIN_INFO,
        .primaryViewConfigurationType = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO,
      };
      xrBeginSession(session, &begin); // then start the frame loop
    } else if (state == XR_SESSION_STATE_STOPPING) {
      xrEndSession(session); // once the frame loop has stopped
    } else if (state == XR_SESSION_STATE_EXITING || state == XR_SESSION_STATE_LOSS_PENDING) {
      xrDestroySession(session);
    }
  } else if (ev.type == XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING) {
    XrEventDataReferenceSpaceChangePending *moved = (XrEventDataReferenceSpaceChangePending *)&ev;
    // a recenter: moved->referenceSpaceType gets a new origin from moved->changeTime on
  }
  ev = (XrEventDataBuffer){.type = XR_TYPE_EVENT_DATA_BUFFER}; // xrPollEvent wrote over the type
}

PRIMARY_STEREO is two views, one per eye: view 0 is the left eye, view 1 the right.13

what trips people up:

the frame loop

a frame is three calls. xrWaitFrame blocks until it’s time to start the next frame, and says when that frame will be on the displays (predictedDisplayTime) and whether to draw at all (shouldRender). xrBeginFrame comes right before the gpu work. xrEndFrame hands the compositor your layers, with the display time and the blend mode.1617

one time around an openxr frame loop, as a column of steps. xrPollEvent drains the event queue: session state changes and recenters. xrWaitFrame blocks until it's time to start a frame, and returns predictedDisplayTime and shouldRender. xrBeginFrame comes right before the gpu work. render locates the views at the display time and, for each swapchain, acquires, waits on, draws and releases an image, only when shouldRender is true. when it's false, a dashed path skips render and goes straight to xrEndFrame, which takes the display time, the blend mode and the layers, and no layers is fine. then the loop goes back to xrPollEvent for the next frame.

the display time from xrWaitFrame is the time for everything you draw in that frame.
XrCompositionLayerProjectionView eyes[2] = {
  {.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW},
  {.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION_VIEW},
};
XrCompositionLayerProjection projection = {
  .type = XR_TYPE_COMPOSITION_LAYER_PROJECTION,
  .space = world,
  .viewCount = 2,
  .views = eyes,
};

while (app_running) {
  poll_events(); // the block above
  if (!session_running) {
    wait_a_moment(); // nothing to draw yet
    continue;
  }
  XrFrameState frame = {.type = XR_TYPE_FRAME_STATE};
  xrWaitFrame(session, NULL, &frame); // blocks until it's time to start the next frame
  xrBeginFrame(session, NULL);        // right before the gpu work

  const XrCompositionLayerBaseHeader *layers[1];
  uint32_t count = 0;
  if (frame.shouldRender) {
    // xrLocateViews at frame.predictedDisplayTime: a pose and a fov for each eye, into eyes[i]
    // each eye's swapchain: xrAcquireSwapchainImage, xrWaitSwapchainImage, draw, xrReleaseSwapchainImage
    layers[count++] = (const XrCompositionLayerBaseHeader *)&projection;
  }
  XrFrameEndInfo end = {
    .type = XR_TYPE_FRAME_END_INFO,
    .displayTime = frame.predictedDisplayTime,
    .environmentBlendMode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE,
    .layerCount = count,
    .layers = layers,
  };
  xrEndFrame(session, &end); // no layers is fine: the display clears
}

what trips people up:

spaces

a pose in openxr is always one space measured in another. there’s no global frame.20 the runtime gives you four reference spaces to start from, all with +y up. in VIEW, LOCAL and LOCAL_FLOOR, -z is forward and +x is to the right. STAGE’s x and z axes run along the edges of the play area:20

spaceoriginfor
VIEWyour head, nowa reticle, a gaze ray
LOCALyour head at the start, leveledcontent near the start
LOCAL_FLOORunder LOCAL, on the floorstanding content
STAGEthe play area’s center, on the floorroom scale

two drawings of the core reference spaces, with each thing at the same place from left to right in both. from the side: local sits at eye height where the app started, local_floor right under it on the floor, stage on the floor at the center of the play area, and view on your head, now, somewhere else. from above: the stage bounds are the area the user set up, with stage's origin at their center and its +x and -z axes along the edges. local is where you started, facing -z. view is you, now, facing another way.

local and local_floor stay where the app started. view goes where you go.

VIEW, LOCAL and LOCAL_FLOOR are always there, LOCAL_FLOOR since 1.1. STAGE is optional, can’t be located until the user has set one up, and gets its size from xrGetReferenceSpaceBoundsRect. VIEW is for things that follow the head: render the world with the poses from xrLocateViews.20

what trips people up:

actions

input in openxr goes by what it means, not by button. you make an action like teleport, suggest which control triggers it on each controller you tested with, and read the action. the runtime has the last word on the binding: user preference, accessibility settings and the hardware that’s actually there all count.2122 this is the spec’s own example, cut down:21

XrActionSetCreateInfo setInfo = {
  .type = XR_TYPE_ACTION_SET_CREATE_INFO,
  .actionSetName = "gameplay",
  .localizedActionSetName = "gameplay",
};
XrActionSet gameplay;
xrCreateActionSet(instance, &setInfo, &gameplay);

// named for what it does, not for a button
XrActionCreateInfo actionInfo = {
  .type = XR_TYPE_ACTION_CREATE_INFO,
  .actionName = "teleport",
  .actionType = XR_ACTION_TYPE_BOOLEAN_INPUT,
  .localizedActionName = "teleport",
};
XrAction teleport;
xrCreateAction(gameplay, &actionInfo, &teleport);

// one suggestion per controller you tested with. the runtime may bind it elsewhere
XrPath profile, select;
xrStringToPath(instance, "/interaction_profiles/khr/simple_controller", &profile);
xrStringToPath(instance, "/user/hand/right/input/select/click", &select);
XrActionSuggestedBinding binding = {.action = teleport, .binding = select};
XrInteractionProfileSuggestedBinding suggested = {
  .type = XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING,
  .interactionProfile = profile,
  .countSuggestedBindings = 1,
  .suggestedBindings = &binding,
};
xrSuggestInteractionProfileBindings(instance, &suggested);

// once per session, after every suggestion. the sets can't change after this
XrSessionActionSetsAttachInfo attach = {
  .type = XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO,
  .countActionSets = 1,
  .actionSets = &gameplay,
};
xrAttachSessionActionSets(session, &attach);

// every frame
XrActiveActionSet active = {.actionSet = gameplay, .subactionPath = XR_NULL_PATH};
XrActionsSyncInfo sync = {
  .type = XR_TYPE_ACTIONS_SYNC_INFO,
  .countActiveActionSets = 1,
  .activeActionSets = &active,
};
xrSyncActions(session, &sync);

XrActionStateGetInfo get = {.type = XR_TYPE_ACTION_STATE_GET_INFO, .action = teleport};
XrActionStateBoolean state = {.type = XR_TYPE_ACTION_STATE_BOOLEAN};
xrGetActionStateBoolean(session, &get, &state);
if (state.changedSinceLastSync && state.currentState) start_teleport();

khr/simple_controller has no hardware of its own: a runtime that supports it maps select, menu, grip, aim and haptics onto whatever controller is there.23

what trips people up:

hand tracking

XR_EXT_hand_tracking reports the joints of each hand, every frame. check supportsHandTracking in the system properties, make one tracker per hand, then locate its joints in a space at the frame’s display time.26

there are 26 joints: the palm, the wrist, four on the thumb and five on each other finger. each has a pose and a radius, the distance from the joint to the skin in meters, which makes a ready collision sphere for a fingertip. every finger joint but the tip sits at the wrist end of the bone it’s named for.26

26 joints: palm, wrist, 4 on the thumb, 5 on each other finger. tips in white

a schematic hand, fingers up, with the 26 joints of XR_EXT_hand_tracking drawn as dots and joined by lines. the palm, in the middle of the hand, and the wrist below it are amber. the thumb has four joints and each other finger five, in cyan, named on the little finger from the wrist out: metacarpal, proximal, intermediate, distal and tip. each finger's metacarpal joint sits in a fan close around the wrist, and the five tips are white.

the joints come in this order, palm and wrist first, so XrHandJointEXT values index the array.
// an extension's functions aren't exported: load each one through xrGetInstanceProcAddr
PFN_xrCreateHandTrackerEXT pfnCreateHandTrackerEXT;
PFN_xrLocateHandJointsEXT pfnLocateHandJointsEXT;
xrGetInstanceProcAddr(instance, "xrCreateHandTrackerEXT", (PFN_xrVoidFunction *)&pfnCreateHandTrackerEXT);
xrGetInstanceProcAddr(instance, "xrLocateHandJointsEXT", (PFN_xrVoidFunction *)&pfnLocateHandJointsEXT);

XrHandTrackerCreateInfoEXT trackerInfo = {
  .type = XR_TYPE_HAND_TRACKER_CREATE_INFO_EXT,
  .hand = XR_HAND_RIGHT_EXT,
  .handJointSet = XR_HAND_JOINT_SET_DEFAULT_EXT,
};
XrHandTrackerEXT right;
pfnCreateHandTrackerEXT(session, &trackerInfo, &right);

// every frame
XrHandJointLocationEXT joints[XR_HAND_JOINT_COUNT_EXT];
XrHandJointLocationsEXT locations = {
  .type = XR_TYPE_HAND_JOINT_LOCATIONS_EXT,
  .jointCount = XR_HAND_JOINT_COUNT_EXT,
  .jointLocations = joints,
};
XrHandJointsLocateInfoEXT locateInfo = {
  .type = XR_TYPE_HAND_JOINTS_LOCATE_INFO_EXT,
  .baseSpace = world,
  .time = frame.predictedDisplayTime,
};
pfnLocateHandJointsEXT(right, &locateInfo, &locations);
if (locations.isActive) {
  XrHandJointLocationEXT tip = joints[XR_HAND_JOINT_INDEX_TIP_EXT];
  // tip.pose and tip.radius: a sphere at the fingertip, for pressing buttons
}

for pinching and poking, reach for actions before your own gesture code. XR_EXT_hand_interaction adds pinch, poke, aim and grip poses to every hand profile, and a profile of its own with a pinch value from 0 to 1, where 1 is finger and thumb touching. runtimes with controllers should offer that profile too, so one set of bindings covers both.27

/interaction_profiles/ext/hand_interaction_ext   the profile
/user/hand/right/input/pinch_ext/value           0 to 1
/user/hand/right/input/pinch_ext/pose            where the pinch is
/user/hand/right/input/poke_ext/pose             the fingertip that pokes

what trips people up:

on visionos, arkit’s HandTrackingProvider does this job. its skeleton has 27 joints: no palm, but two forearm joints, forearmArm and forearmWrist, next to wrist. it needs NSHandsTrackingUsageDescription in the info.plist, and it only runs while your app has a full space open.3031

let session = ARKitSession()
let hands = HandTrackingProvider()

// in a task on your immersive space's view, once the space is open
guard HandTrackingProvider.isSupported else { return }
try await session.run([hands])
for await update in hands.anchorUpdates {
    let hand = update.anchor
    guard hand.isTracked, let skeleton = hand.handSkeleton else { continue }
    let tip = skeleton.joint(.indexFingerTip)
    let worldFromTip = hand.originFromAnchorTransform * tip.anchorFromJointTransform
    // a fingertip collider goes at worldFromTip
}

spatial anchors

an anchor is a pose the runtime pins to a real place. as the headset’s map of the room gets better, the runtime adjusts each anchor on its own to keep it on its spot, so a thing drawn relative to its anchor stays on the desk. and unlike LOCAL, an anchor doesn’t move when the user recenters.32

from abovedeskthe wall across from the deskwhere the app startedyou, nowon an anchorlocalin local space

both mugs sit on the desk. you have walked away from where the app started. press recenter, as someone would to bring the app back in front of them

a room seen from above, with a desk along the top wall and two virtual mugs on it. the cyan mug was placed in local space; the amber one sits on an anchor. the app started with you near the middle of the room, facing the desk, and you have since walked to the right and turned to face the far wall. a button recenters: local space moves to where you stand and turns the way you face, and the cyan mug, which keeps its local coordinates, swings with it and ends up across the room by the far wall. the amber mug stays on the desk. the same button, now reading put it back, puts everything back.

the cyan mug kept its numbers. the numbers now mean a different place.

where it lives on each platform:

openxrquestvisionos
makexrCreateSpatialAnchorEXTxrCreateSpatialAnchorFBWorldAnchor
keepxrPersistSpatialEntityAsyncEXTxrSaveSpacesMETAautomatic
find againby uuidxrDiscoverSpacesMETAanchorUpdates

on quest, an anchor has to be storable before it saves; on visionos, arkit saves it for you and hands back the ones nearby. the openxr column is XR_EXT_spatial_anchor and XR_EXT_spatial_persistence, both ratified by khronos: the cross-vendor way, on runtimes that ship them.3233 meta’s docs use meta’s own: XR_FB_spatial_entity to make anchors, and meta’s persistence and discovery extensions to save and find them. the persistence one replaces XR_FB_spatial_entity_storage, which the spec now calls obsolete.3435 on quest, each call answers later with an event:

// an anchor where the mug sits. the anchor arrives later, as an event
XrSpatialAnchorCreateInfoFB anchorInfo = {
  .type = XR_TYPE_SPATIAL_ANCHOR_CREATE_INFO_FB,
  .space = world,
  .poseInSpace = mugPose,
  .time = frame.predictedDisplayTime,
};
XrAsyncRequestIdFB request;
pfnCreateSpatialAnchorFB(session, &anchorInfo, &request);

// in the event loop
if (ev.type == XR_TYPE_EVENT_DATA_SPATIAL_ANCHOR_CREATE_COMPLETE_FB) {
  XrEventDataSpatialAnchorCreateCompleteFB *done = (XrEventDataSpatialAnchorCreateCompleteFB *)&ev;
  anchor = done->space; // and keep done->uuid: it finds the anchor again next time
}

// every frame: where the anchor is now, and the mug with it
XrSpaceLocation where = {.type = XR_TYPE_SPACE_LOCATION};
xrLocateSpace(anchor, world, frame.predictedDisplayTime, &where);

// to keep it across sessions, turn on its storable component
XrSpaceComponentStatusSetInfoFB storable = {
  .type = XR_TYPE_SPACE_COMPONENT_STATUS_SET_INFO_FB,
  .componentType = XR_SPACE_COMPONENT_TYPE_STORABLE_FB,
  .enabled = XR_TRUE,
};
pfnSetSpaceComponentStatusFB(anchor, &storable, &request);

// when XrEventDataSpaceSetStatusCompleteFB says it's on, save it
XrSpacesSaveInfoMETA save = {.type = XR_TYPE_SPACES_SAVE_INFO_META, .spaceCount = 1, .spaces = &anchor};
pfnSaveSpacesMETA(session, &save, &request);

meta’s anchor sample also asks for the anchor permission in its manifest: the last line of the manifest under quest, below.36 on visionos, a world tracking provider does it all, and needs no permission:3731

let session = ARKitSession()
let worldTracking = WorldTrackingProvider()

// in a task on your immersive space's view, once the space is open
try await session.run([worldTracking])

let anchor = WorldAnchor(originFromAnchorTransform: lampTransform)
try await worldTracking.addAnchor(anchor)
lamps[anchor.id] = lamp // what the anchor means is yours to keep

// this run and later ones: arkit hands back the anchors near you
for await update in worldTracking.anchorUpdates {
    switch update.event {
    case .added, .updated: place(lamps[update.anchor.id], at: update.anchor.originFromAnchorTransform)
    case .removed: hide(lamps[update.anchor.id])
    }
}

what trips people up:

passthrough

passthrough shows the room on a headset you can’t see through: cameras film it, and the system draws it along with your frames. in core openxr, you pick how the composited image meets the world every frame, in xrEndFrame: OPAQUE for vr, ADDITIVE or ALPHA_BLEND for ar. xrEnumerateEnvironmentBlendModes lists what a system can do.38

quest does it with a layer instead, from XR_FB_passthrough. your app never sees the camera images. it submits a placeholder layer, XrCompositionLayerPassthroughFB, and the compositor draws the room there. the blend mode stays OPAQUE.39

a stack of three layers, in the order an app hands them to xrEndFrame for passthrough on quest. layers[0], at the back in cyan, is the passthrough placeholder that the compositor fills with the room. layers[1], in amber, is the app's projection layer: its eye images, where alpha 0 lets the room show once source alpha is on. layers[2], on top in white, is a quad, a flat panel like a menu. the compositor paints them in array order, each over the last.

the order decides what covers what: put the passthrough layer after the projection layer and the room covers your scene.
// once: the feature (one per session), then a layer. both start running
XrPassthroughCreateInfoFB featureInfo = {
  .type = XR_TYPE_PASSTHROUGH_CREATE_INFO_FB,
  .flags = XR_PASSTHROUGH_IS_RUNNING_AT_CREATION_BIT_FB,
};
XrPassthroughFB feature;
pfnCreatePassthroughFB(session, &featureInfo, &feature);

XrPassthroughLayerCreateInfoFB layerInfo = {
  .type = XR_TYPE_PASSTHROUGH_LAYER_CREATE_INFO_FB,
  .passthrough = feature,
  .flags = XR_PASSTHROUGH_IS_RUNNING_AT_CREATION_BIT_FB,
  .purpose = XR_PASSTHROUGH_LAYER_PURPOSE_RECONSTRUCTION_FB,
};
XrPassthroughLayerFB room;
pfnCreatePassthroughLayerFB(session, &layerInfo, &room);

// every frame: the room first, so it's at the back, then your eyes with their alpha on
XrCompositionLayerPassthroughFB roomLayer = {
  .type = XR_TYPE_COMPOSITION_LAYER_PASSTHROUGH_FB,
  .flags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
  .space = XR_NULL_HANDLE,
  .layerHandle = room,
};
projection.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT; // clear to alpha 0 where the room shows
const XrCompositionLayerBaseHeader *layers[] = {
  (const XrCompositionLayerBaseHeader *)&roomLayer,
  (const XrCompositionLayerBaseHeader *)&projection,
};
// then xrEndFrame with these two, and environmentBlendMode XR_ENVIRONMENT_BLEND_MODE_OPAQUE

what trips people up:

on visionos, passthrough is where you start. an ImmersiveSpace opens in the mixed style, your content in the room. progressive replaces part of the room with a portal the user sizes with the digital crown, 120 to 360 degrees by default, and full replaces all of it except the user’s arms and hands. in progressive and full, the system keeps a boundary about 1.5 m from where the head started: near it, the experience fades toward the room, and past it the app’s icon takes its place.4344

@main
struct MyApp: App {
    @State private var style: ImmersionStyle = .mixed

    var body: some Scene {
        WindowGroup { ContentView() }
        ImmersiveSpace(id: "room") { RoomView() }
            .immersionStyle(selection: $style, in: .mixed, .progressive, .full)
    }
}

the user can always press and hold the digital crown to recenter, or double-click it to hide everything and see the room.44

locomotion + comfort

in vr, the eyes can see motion the body doesn’t feel. that sensation is vection, and its clash with the inner ear is what makes people sick. the inner ear senses changes in motion, not steady speed, so starts, stops and turns are the hard part.45

give people choices, and start them on the gentle ones:46

howcomfort
teleportjump to where you aimgentle. can disorient
slideglide with the stickcan make people sick
snap turnturn 30, 45 or 90° at oncegentle. offer all three
smooth turnturn while the stick is heldrough. let people set the speed
vignettedarken the edges while movingless motion seen. can feel cramped

the vignette row is from meta’s optic flow guide.47

330°0°30°

a post every 30°. the cyan one is where you started, the white tick is straight ahead

pick a turn and press a button. drag the slider to see what the vignette covers

facing 0°

a first-person view of a ring of posts, one every 30 degrees, seen through a 90 degree window. the post you started facing is cyan, and a white tick marks straight ahead. two buttons turn you left or right by 45 degrees, and a menu picks how: snap jumps there in one step, smooth slides there at 180 degrees a second, a quarter of a second for the turn, with a vignette darkening the edges while it moves. a slider sets the vignette's strength from 0 to 1, starting at 0.5, and shows what it covers while you drag it. under reduced motion, the smooth turn jumps too.

try smooth with the vignette at 0, then at 1. at 1, the edges of the view go dark while it turns.

the rest of meta’s advice, in short:

in webxr, meta’s immersive web sdk has these built in. it starts with snap turns of 45°, smooth turns at 180°/s, the vignette at 0.5 and a slide of up to 5 m/s, which is faster than the design guide’s run.49 the figure above uses the turn defaults.

import { LocomotionSystem, SessionMode, TurningMethod, World } from '@iwsdk/core';

const world = await World.create(document.getElementById('scene'), {
  xr: { sessionMode: SessionMode.ImmersiveVR },
  features: {
    // comfortAssistLevel is the vignette's strength, 0 to 1. 0 turns it off
    locomotion: { turningMethod: TurningMethod.SnapTurn, comfortAssistLevel: 0.5 },
  },
});

// from your comfort menu
const locomotion = world.getSystem(LocomotionSystem);
locomotion.config.turningAngle.value = 30; // the user's pick: 30, 45 or 90
locomotion.config.turningMethod.value = TurningMethod.SmoothTurn;
locomotion.config.turningSpeed.value = 120; // degrees a second
locomotion.config.slidingSpeed.value = 1.4; // a walk, in m/s

this follows meta’s own examples for the sdk’s World options and its locomotion settings.50

quest / visionos basics

quest

a quest runs horizon os, which is built on android. you can build for it with unity, unreal, native c or c++ on openxr, meta’s spatial sdk in kotlin, a plain android app, or the web.51 the native path, checked against meta’s openxr sdk v85 and meta’s docs as read on 28 october 2026:35253

  1. join or make a team on the meta horizon developer dashboard, and verify your account with a phone number or a payment method.
  2. turn on developer mode in the meta horizon app on your phone: headset icon > your headset > Headset Settings > Developer Mode.
  3. plug the headset in with a usb-c data cable. in the headset, answer the usb debugging prompt with Always allow from this computer. on windows, install the oculus adb drivers first.
  4. build a sample in android studio: File > Open, pick the sdk’s Samples/build.gradle, then Run in the toolbar.
adb devices             # is the headset there?
adb install -r app.apk  # put your build on it, over the last one
adb tcpip 5555          # to drop the cable: switch adb to wi-fi,
adb connect <ip>:5555   # then connect to the headset's ip address
<!-- in the activity: this category makes it a vr app -->
<intent-filter>
  <action android:name="android.intent.action.MAIN" />
  <category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
  <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!-- one line per feature you use -->
<uses-feature android:name="oculus.software.handtracking" android:required="false" />
<uses-permission android:name="com.oculus.permission.HAND_TRACKING" />
<uses-feature android:name="com.oculus.feature.PASSTHROUGH" android:required="true" />
<uses-permission android:name="com.oculus.permission.USE_ANCHOR_API" />

the lines come from meta’s openxr page and the v85 samples.54293639 on android, openxr also needs two steps before xrCreateInstance: get xrInitializeLoaderKHR from xrGetInstanceProcAddr with a null instance and call it with an XrLoaderInitInfoAndroidKHR, then list XR_KHR_android_create_instance and chain an XrInstanceCreateInfoAndroidKHR into the instance’s create info. meta supports the khronos loader for android, openxr_loader_for_android, from 1.0.34.54

what trips people up:

vision pro

apple vision pro runs visionos. an app is a set of swiftui scenes: windows for 2d, volumes for 3d, and an immersive space to fill the room. realitykit draws the 3d, and arkit gives you hands, planes and anchors. if you bring your own metal renderer, compositor services hands you the drawables and the frame timing, the job openxr’s frame loop does.555657 checked against xcode 27:4585960

  1. get a mac with apple silicon running macos tahoe 26.6 or later, and xcode 27.
  2. make a project: File > New > Project, then visionOS > App.
  3. run it: pick a simulator or a device in the run destination menu, then Product > Run.
  4. pair a vision pro: on it, Settings > General > Remote Devices. in xcode, Xcode > Open Developer Tool > Device Hub, then + > Pair Nearby Device, and type the pin it shows.
  5. turn on developer mode on the vision pro: Settings > Privacy & Security > Developer Mode, then restart.
  6. sign in for signing: Xcode > Settings > Apple Accounts, then pick a team in Signing & Capabilities.

in the simulator, in xcode 27’s device hub, after you pick “Select to interact with the visionOS content” at the bottom of the canvas:61

topress
look at somethingmove the pointer over it
tap (a pinch)click
pinch and holdclick and hold
pinch and dragdrag
drag toward or awayshift-drag
walkW A S D, or the arrow keys
go up, go downE, Q
look aroundcontrol-drag
reset the viewReset Camera, bottom right
type into the appDevice > Keyboard > Keyboard Capture
give the keys backesc

what trips people up:

in a browser: webxr

webxr is the browser’s xr api, a w3c candidate recommendation draft as of 9 june 2026.5 the quest browser runs it, passthrough included, and safari on visionos has run immersive webxr since safari 18.6263 the session modes are inline, immersive-vr and immersive-ar, the last from the ar module.564 the reference spaces line up with openxr’s:

webxropenxrorigin
viewerVIEWyour head
localLOCALnear you, when made
local-floorLOCAL_FLOORon the floor, near you
bounded-floorSTAGEon the floor, with bounds
unboundedUNBOUNDED_MSFT65far from the start
button.addEventListener('click', async () => {
  // immersive sessions have to start from a click like this one
  if (!(await navigator.xr?.isSessionSupported('immersive-vr'))) return;
  const session = await navigator.xr.requestSession('immersive-vr', { requiredFeatures: ['local-floor'] });
  const gl = canvas.getContext('webgl2', { xrCompatible: true });
  session.updateRenderState({ baseLayer: new XRWebGLLayer(session, gl) });
  const floor = await session.requestReferenceSpace('local-floor');

  session.requestAnimationFrame(function frame(time, xrFrame) {
    session.requestAnimationFrame(frame);
    const pose = xrFrame.getViewerPose(floor);
    if (!pose) return;
    const layer = session.renderState.baseLayer;
    gl.bindFramebuffer(gl.FRAMEBUFFER, layer.framebuffer);
    for (const view of pose.views) {
      const { x, y, width, height } = layer.getViewport(view);
      gl.viewport(x, y, width, height);
      draw(view.projectionMatrix, view.transform.inverse.matrix);
    }
  });
});

what trips people up:

pitfalls

sources

  1. introduction.adoc (opens in a new tab) in the openxr 1.1.65 spec, lines 26 to 60: xr as the continuum that takes in vr, ar and mixed reality; openxr as the interface between an app and a runtime that handles composition, peripherals and tracking; and the order a program goes in, from instance to system to buffers to session and its loop. ↩ ↩2 ↩3

  2. the openxr docs changelog (opens in a new tab) at tag release-1.1.65: 1.1.65 came out on 2026-10-16. xr.xml (opens in a new tab) at the same tag sets XR_CURRENT_API_VERSION to 1.1.65, at line 159. ↩

  3. meta’s openxr mobile sdk (opens in a new tab) download page, version 85.0, and the readme (opens in a new tab) at tag v85: the samples, and building them with android studio by opening Samples/build.gradle. ↩ ↩2

  4. the xcode 27 release notes (opens in a new tab): the visionos 27 sdk, macos tahoe 26.6 or later, and device hub 27 not showing the video of, or sending input to, a physical apple vision pro. the visionos 27 release notes (opens in a new tab) say the sdk comes with xcode 27. ↩ ↩2 ↩3

  5. webxr device api (opens in a new tab), w3c candidate recommendation draft, 9 june 2026: the session modes, the reference space types, the default features for immersive sessions, the secure context, and the transient user activation an immersive request needs. ↩ ↩2 ↩3 ↩4 ↩5

  6. fundamentals.adoc (opens in a new tab), lines 199 to 204: a runtime implements the api, and only one can be active at a time. ↩

  7. system.adoc (opens in a new tab), lines 1 to 66: xrGetSystem picks a system by form factor, and XR_FORM_FACTOR_HEAD_MOUNTED_DISPLAY is a display on the head. ↩

  8. instance.adoc (opens in a new tab): extensions are enabled at xrCreateInstance, and one that can’t be found fails it with XR_ERROR_EXTENSION_NOT_PRESENT (lines 226 to 234); an apiVersion the runtime doesn’t support returns XR_ERROR_API_VERSION_UNSUPPORTED (lines 330 to 336). ↩ ↩2 ↩3

  9. khronos’s list of conformant openxr products (opens in a new tab), read on 2026-10-28: meta’s quest 3 and quest 3s on horizon os v83, conformant to openxr 1.0 and 1.1 on 2026-01-18. ↩

  10. session.adoc (opens in a new tab), lines 163 to 240: one XrGraphicsBinding* struct in the create info’s next chain, and an error if the graphics extension’s xrGet*GraphicsRequirements wasn’t called first. ↩

  11. session.adoc (opens in a new tab), lines 16 to 104, and its lifecycle figure: the ten steps from a new session in IDLE to xrDestroySession at EXITING, the paused app waiting in IDLE, and LOSS_PENDING from any state. the diagram on this page redraws that figure, with a line in each box from the state descriptions in lines 499 to 648. ↩ ↩2

  12. fundamentals.adoc (opens in a new tab), lines 1702 to 1790: events wait in a queue, the app reads them one at a time with xrPollEvent, and each call overwrites the buffer’s type with the event’s. ↩

  13. view_configurations.adoc (opens in a new tab), lines 30 to 60: PRIMARY_STEREO is two views, index 0 the left eye and 1 the right, picked at xrBeginSession. ↩

  14. session.adoc (opens in a new tab), lines 106 to 161: xrBeginSession only in READY, xrEndSession only in STOPPING, and why it’s better to destroy a session at EXITING. ↩ ↩2

  15. session.adoc (opens in a new tab), lines 574 to 590: a visible session without focus, for example under a modal pop-up, keeps rendering and submitting its layers. ↩

  16. rendering.adoc (opens in a new tab), lines 764 to 905: xrWaitFrame throttles the loop and returns predictedDisplayTime, predictedDisplayPeriod and shouldRender; it can be called from any thread, once per frame, and every stage should use the same display time; and the loop keeps running with no layers while shouldRender is false. ↩ ↩2 ↩3 ↩4

  17. rendering.adoc (opens in a new tab), lines 910 to 1116: xrBeginFrame right before the gpu work, and xrEndFrame with a display time, a blend mode and the layers. no layers clears the display. ↩

  18. rendering.adoc (opens in a new tab), lines 579 to 640: xrLocateViews predicts a pose and a field of view per view for a display time, and the prediction gets better the later you ask. ↩ ↩2

  19. rendering.adoc (opens in a new tab), lines 1132 to 1146 (layers drawn in array order, the first one first, painter’s algorithm) and 1174 to 1202 (without the source alpha flag a layer’s alpha is 1, and how alpha blends a layer over the ones under it). ↩ ↩2

  20. spaces.adoc (opens in a new tab), lines 1 to 330: poses are always between two spaces; runtimes may adjust origins as they learn the world; VIEW, LOCAL, LOCAL_FLOOR and STAGE, their origins and axes; the first three must be supported and STAGE is optional; recentering, and the event that comes before it; and large head-locked content being uncomfortable. ↩ ↩2 ↩3 ↩4 ↩5 ↩6 ↩7

  21. input.adoc (opens in a new tab), lines 8 to 140: actions stand for what the app wants, not for hardware, and the runtime may pick a different control. the code on this page cuts down the spec’s example there, which suggests a binding on a vendor profile and adds haptics. ↩ ↩2

  22. input.adoc (opens in a new tab), lines 476 to 603: suggested bindings are hints, the interaction profile only changes in xrSyncActions, and suggesting for an attached set fails with XR_ERROR_ACTIONSETS_ALREADY_ATTACHED. ↩ ↩2 ↩3 ↩4

  23. semantic_paths.adoc (opens in a new tab), lines 665 to 686: the khronos simple controller profile, its five paths, and runtimes mapping it to the real hardware. ↩

  24. input.adoc (opens in a new tab), lines 650 to 682: attaching makes the sets immutable, and a second xrAttachSessionActionSets on a session fails. ↩

  25. input.adoc (opens in a new tab), lines 1119 to 1142: a pose action’s location comes from an action space, made with xrCreateActionSpace and located with xrLocateSpace. ↩

  26. ext_hand_tracking.adoc (opens in a new tab), revision 4: supportsHandTracking, one tracker per hand, xrLocateHandJointsEXT at a time in a base space, the unobstructed range of motion, isActive and the valid flags, and the conventions section: 26 joints, named after the bone at their end away from the tip, the palm at the center of the middle finger’s metacarpal and not the grip pose, and the radius as the distance to the skin. the figure’s joint order is XrHandJointEXT in xr.xml (opens in a new tab), lines 7609 to 7636, and hand-joints.test.ts, next to the figure in site/src/visuals/xr/, checks its count. ↩ ↩2 ↩3 ↩4 ↩5 ↩6

  27. ext_hand_interaction.adoc (opens in a new tab), revision 2: the aim, grip, pinch and poke poses on every hand profile, the hand_interaction_ext profile with pinch_ext/value, aim_activate_ext/value and grasp_ext/value, and runtimes with controllers mapping them to it. ↩

  28. api_initialization.adoc (opens in a new tab), lines 24 to 55: the loader must export the core functions, and extension functions come from xrGetInstanceProcAddr. ↩

  29. meta’s enable hand tracking (opens in a new tab) page, read on 2026-10-28: without the HAND_TRACKING permission and the oculus.software.handtracking feature, an app sees no hands, and the user has to have hand tracking on. the XrHandsFB sample’s manifest (opens in a new tab) at v85, lines 19 to 23, has both, with the feature not required. ↩ ↩2

  30. HandTrackingProvider (opens in a new tab) and HandSkeleton.JointName (opens in a new tab) in apple’s arkit docs: three forearm and wrist joints, four on the thumb and five on each finger, 27 in all, and no palm. ↩

  31. setting up access to arkit data (opens in a new tab) in apple’s docs: NSHandsTrackingUsageDescription and NSWorldSensingUsageDescription, world tracking without authorization, and arkit data only while the app shows a full space with other apps hidden. ↩ ↩2 ↩3

  32. ext_spatial_anchor.adoc (opens in a new tab), revision 1: anchors adjusted on their own to keep their place in the world, unaffected by recentering, xrCreateSpatialAnchorEXT in a spatial context, and the guidelines to share one anchor among things that don’t move relative to each other and to destroy the ones you no longer use. ↩ ↩2 ↩3 ↩4

  33. ext_spatial_persistence.adoc (opens in a new tab) and its operations extension at the same tag: a persisted entity is known by a uuid across sessions, saved with xrPersistSpatialEntityAsyncEXT and found by uuid during discovery. both extensions are marked ratified in xr.xml. ↩

  34. meta’s spatial anchors features and lifecycle (opens in a new tab) page, updated 2024-05-27: a uuid per anchor, within 3 m for best results, xrCreateSpatialAnchorFB, xrLocateSpace, the storable component and xrSaveSpacesMETA, xrDiscoverSpacesMETA, and how erasing differs from destroying. ↩ ↩2 ↩3 ↩4

  35. meta_spatial_entity_persistence.adoc (opens in a new tab), lines 18 to 37: XR_META_spatial_entity_persistence, the next generation of meta’s anchor storage, replacing XR_FB_spatial_entity_storage and its batch extension, which it calls obsolete, and used with XR_META_spatial_entity_discovery. ↩

  36. the XrSpatialAnchor sample’s manifest (opens in a new tab) in meta’s openxr sdk at v85, line 21: the USE_ANCHOR_API permission. ↩ ↩2

  37. tracking specific points in world space (opens in a new tab) and WorldAnchor (opens in a new tab) in apple’s docs: addAnchor, arkit keeping each anchor’s uuid and pose across runs while the app keeps what it means, and updates only for nearby anchors. ↩ ↩2

  38. rendering.adoc (opens in a new tab), lines 1454 to 1520: OPAQUE for vr and ADDITIVE or ALPHA_BLEND for ar, chosen each frame in xrEndFrame, and xrEnumerateEnvironmentBlendModes. ↩ ↩2

  39. meta’s implement passthrough (opens in a new tab) page, read on 2026-10-28: the compositor renders passthrough into a placeholder layer the app submits, the app can’t see the images, the com.oculus.feature.PASSTHROUGH manifest line, up to three passthrough layers, the layer order putting it under or over, pausing instead of leaving a layer out, and quest requiring XR_ENVIRONMENT_BLEND_MODE_OPAQUE. ↩ ↩2 ↩3 ↩4 ↩5

  40. fb_passthrough.adoc (opens in a new tab), revision 5: one XrPassthroughFB per session, and the passthrough layer’s space set to XR_NULL_HANDLE. ↩

  41. meta’s passthrough camera api overview (opens in a new tab), updated 2026-10-07: quest 3 and 3s, horizon os v74 or later, android’s camera2, the horizonos.permission.HEADSET_CAMERA or android.permission.CAMERA permission, and passthrough turned on. ↩

  42. accessing the main camera (opens in a new tab) in apple’s docs: an enterprise api with an entitlement, a license file and NSMainCameraUsageDescription. ↩

  43. ImmersionStyle (opens in a new tab) in apple’s swiftui docs, with its mixed (opens in a new tab), progressive (opens in a new tab) and full (opens in a new tab) styles: mixed is the default, progressive is a portal sized with the digital crown, and full hides passthrough except the upper limbs. ↩

  44. immersive experiences (opens in a new tab) in apple’s human interface guidelines: passthrough as camera video, the digital crown to recenter or to show the surroundings, the default progressive range of 120 to 360 degrees, and the boundary about 1.5 m from the starting head position. ↩ ↩2

  45. meta’s comfort and usability (opens in a new tab) page, updated 2025-12-17: vection, the vestibular organs answering changes in motion and not a constant speed, quantized speeds with instant changes, walking at about 1.4 m/s and running at about 2.8 m/s, judder, and seated users. ↩ ↩2 ↩3 ↩4

  46. meta’s locomotion user preferences (opens in a new tab) page, updated 2026-09-08: teleport against slide and snap against smooth turn, snap angles of 30, 45 or 90 degrees, letting users set the smooth turn’s speed, turning for people in chairs that don’t rotate, and per-app settings that default to teleport and snap turn, switch while the app runs, and persist. ↩ ↩2 ↩3 ↩4

  47. meta’s reducing optic flow (opens in a new tab) article, updated 2026-05-11: vignettes limit visible optic flow, and a narrower view can feel disorienting or claustrophobic. ↩

  48. meta’s locomotion best practices (opens in a new tab), updated 2025-12-17: smooth turning as an opt-in, testing with many different users, and the recommended, comfortable and advanced presets. ↩ ↩2

  49. the defaults in @iwsdk/core 1.0.1’s locomotion.js (opens in a new tab), lines 43 to 51: comfortAssist 0.5, slidingSpeed 5, turningMethod snap turn, turningAngle 45 and turningSpeed 180. the figure’s numbers come from site/src/visuals/xr/comfort.ts, which comfort.test.ts pins. ↩

  50. meta’s immersive web sdk docs on locomotion (opens in a new tab) and turning (opens in a new tab), updated 2026-09-04, and on slide (opens in a new tab): the World locomotion option with comfortAssistLevel, and tuning turningAngle, turningSpeed and slidingSpeed through world.getSystem(LocomotionSystem). ↩

  51. meta’s platforms (opens in a new tab) page, read on 2026-10-28: horizon os is built on android, and the paths are unity, unreal, native openxr, the meta spatial sdk, android apps, and the web with webxr. ↩

  52. meta’s device setup (opens in a new tab) page, updated 2026-08-06: a team and a verified account, being 18 or older, developer mode in the meta horizon app, the usb-c cable and “always allow from this computer”, and the adb drivers for windows. ↩ ↩2

  53. meta’s use adb with meta quest (opens in a new tab) page, read on 2026-10-28: adb devices, adb install -r, adb tcpip 5555 and adb connect, -s when two devices show, and cloud backup skipping apps installed with adb. ↩ ↩2 ↩3

  54. meta’s openxr on android (opens in a new tab) page, updated 2025-01-23: the IMMERSIVE_HMD intent category, the khronos android loader (org.khronos.openxr) from 1.0.34, xrInitializeLoaderKHR with XrLoaderInitInfoAndroidKHR, and XR_KHR_android_create_instance. ↩ ↩2

  55. visionos (opens in a new tab) in apple’s docs: a mac with apple silicon, swiftui scenes from windows to spaces, realitykit for 3d, and arkit for the surroundings and custom gestures. ↩

  56. creating your first visionos app (opens in a new tab) in apple’s docs: File > New > Project, the visionOS app template, and windows for 2d content and volumes for 3d. ↩

  57. compositor services (opens in a new tab) in apple’s docs: drawing to the displays with metal and your own engine, with a layer renderer that gives the frame timing and the textures. ↩

  58. running your app on simulated or physical devices (opens in a new tab) in apple’s docs: the run destination menu, Product > Run, signing in Xcode > Settings > Apple Accounts, and simulators not matching a device’s performance or features. ↩ ↩2

  59. managing your simulated and physical devices in device hub (opens in a new tab) in apple’s docs: Xcode > Open Developer Tool > Device Hub, Pair Nearby Device, Settings > General > Remote Devices on visionos, ipv6, and the pin. ↩ ↩2

  60. enabling developer mode on a device (opens in a new tab) in apple’s docs: the switch in Privacy & Security, the restart, and the setting only appearing once pairing has started or the device was paired before. ↩ ↩2

  61. interacting with your visionos app in device hub (opens in a new tab) in apple’s docs: the gestures, the movement keys, control-drag, the reset camera button, keyboard capture, and mac virtual display for a physical device. ↩ ↩2

  62. meta’s webxr mixed reality (opens in a new tab) page, read on 2026-10-28: immersive-ar for passthrough, drawing on a transparent background, and no access to the camera pixels. ↩ ↩2

  63. the safari 18 release notes (opens in a new tab): immersive webxr on visionos. ↩

  64. webxr augmented reality module, level 1 (opens in a new tab), w3c candidate recommendation draft: immersive-ar. ↩

  65. msft_unbounded_reference_space.adoc (opens in a new tab): the UNBOUNDED_MSFT reference space, for moving freely many meters from the start, its origin drifting to stay stable near the viewer. ↩