mcpbeat

Xb Depth

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.

606 tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
455
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/google/xrblocks --skill xb-depth

The instruction itself

5 sections, as written by the author

xb-depth: depth sensing & occlusion

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.

Enable depth (with 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;

Depth-mesh colliders for physics

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.)

Useful APIs

  • xb.showReticleOnDepthMesh(true) — let the reticle target the depth mesh.
  • xb.core.depth.depthMesh — the depth mesh object (e.g. ignoreReticleRaycast).
  • Occlusion is handled by the depth subsystem (src/depth/occlusion/);

demos/occlusion shows real-people-in-front-of-virtual-objects.

Notes

  • Depth sensing requires a device/runtime that supports the WebXR Depth Sensing API; the

simulator provides a simulated depth source for desktop testing.

  • Depth + physics is the recipe behind demos/ballpit and demos/splash.

How to use it

Copy the folder

Take google/xb-depth from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

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.