google/xb-depth
>- Add WebXR depth sensing to an XR Blocks app — a live depth map and depth mesh of the room — so virtual content is occluded by real-world geometry and (optionally) generates physics colliders that match the environment. Use for realistic occlusion (a person walks in front of a virtual object), depth-aware reticles, or depth-mesh collision for physics. Covers `enableDepth()`, the `DepthOptions` presets (`xrDepthMeshOptions`, `xrDepthMeshPhysicsOptions`), `colliderUpdateFps`, and `showReticleOnDepthMesh`. Pair with xb-physics for geometry-aware collisions.
npx skills add https://github.com/google/xrblocks --skill xb-depth
Depth gives virtual objects awareness of real-world geometry: occlusion, depth-aware
reticles, and an optional depth-mesh collider for physics. See samples/depthmap,
samples/depthmesh, and demos/occlusion.
const options = new xb.Options();
options.enableDepth(); // depth sensing + depth mesh
xb.init(options);
enableDepth() applies the xrDepthMeshOptions preset. For finer control, build
DepthOptions yourself:
options.depth = new xb.DepthOptions(xb.xrDepthMeshOptions);
options.depth.matchDepthView = false;
To make real geometry collidable (e.g. balls bounce off the floor/furniture), use the
physics preset and set a collider refresh rate, then enable physics (see
xb-physics):
import RAPIER from '@dimforge/rapier3d-simd-compat';
options.depth = new xb.DepthOptions(xb.xrDepthMeshPhysicsOptions);
options.depth.depthMesh.colliderUpdateFps = 5; // rebuild colliders 5×/sec
options.physics.RAPIER = RAPIER;
(Alternatively, scene-mesh detection: options.world.enableMeshDetection() — see
xb-world.)
xb.showReticleOnDepthMesh(true) — let the reticle target the depth mesh.xb.core.depth.depthMesh — the depth mesh object (e.g. ignoreReticleRaycast).src/depth/occlusion/);demos/occlusion shows real-people-in-front-of-virtual-objects.
simulator provides a simulated depth source for desktop testing.
demos/ballpit and demos/splash.Take google/xb-depth from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.