<XrPlanes>
Draws the real surfaces the headset found (walls, floor, tables, from the room setup on a Quest 3) as tinted outlines in a passthrough session. Show it while the user carries a window that snaps, so they see where it can go, or to check a room setup. It draws nothing outside a session or on devices without plane detection.
There is no live demo on this page: planes exist only in a passthrough session on a headset with a room setup. Try it in the playground on a Quest 3, or in the emulator's synthetic room (see Mixed reality).
Usage
<XrPlanes :labels="['wall', 'table']" />
<XrPlanes color="#22c55e" :opacity="0.2" />For the planes themselves (to place content on the table, count the walls), use the composable:
import { useXrPlanes, useXrFrame } from 'vue-xr-ui'
const planes = useXrPlanes()
const table = computed(() => planes.value.find((p) => p.label === 'table'))
useXrFrame(() => {
// matrix, center and normal are world space and update every frame
if (table.value?.tracked) lamp.position.copy(table.value.center)
})Each plane has label (wall, floor, ceiling, table, couch, window, door, wall art, other...), orientation, matrix (plane to world: the plane lies in its local x/z, +y is the normal), polygon, min / max, center, normal and tracked.
API
Props
| Prop | Type | Default | Description |
|---|---|---|---|
opacity | number | 0.12 | Opacity of the fill; the outline is drawn three times stronger. |
labels | readonly string[] | [] | Only planes with these labels (wall, floor, table...). All when empty. |
color | string | Colour, any CSS colour. The theme's accent by default. |