google/xb-world
>- Understand the real world in an XR Blocks app via `xb.world` — detect horizontal/ vertical planes, reconstruct scene meshes, and recognize physical objects (with a Gemini or MediaPipe backend) as `THREE.Object3D`s positioned in 3D. Use to place virtual content on real surfaces, react to room geometry, or attach affordances to recognized objects. Covers `enablePlaneDetection()`, `enableObjectDetection()`, `options.world.*`, `xb.world.objects.runDetection()`, and `xb.world.placeOnHorizontalSurface()`. For raw depth/occlusion use xb-depth.
npx skills add https://github.com/google/xrblocks --skill xb-world
xb.world exposes the real environment to your app. See templates/8_objects,
samples/depthmesh, and src/world/.
const options = new xb.Options();
options.enablePlaneDetection(); // detected planes become part of the world
xb.init(options);
Auto-place a model on a detected horizontal surface (e.g. the floor/a table):
xb.world.placeOnHorizontalSurface(model, /*timeout*/ {seconds: 30});
Object detection needs AI, the environment camera, and depth (to lift 2D detections into 3D):
options.enableAI(); // detection backend (see xb-ai — needs a key)
options.enableCamera('environment'); // video feed for the model
options.enableDepth(); // project detections into 3D
options.world.enableObjectDetection();
options.world.objects.showDebugVisualizations = true;
Run detection on demand (e.g. on pinch/click) — it resolves to an array of THREE.Object3D
placed at the detected world positions:
async onSelectEnd() {
const detected = await xb.world.objects.runDetection();
// each entry is a THREE.Object3D with the detected world pose + metadata
console.log('detected', detected.length);
}
options.world.enableMeshDetection();
options.world.meshes.showDebugVisualizations = true; // visualize reconstructed geometry
src/world/objects/backends/(GeminiDetectorBackend, MediaPipeDetectorBackend); choose via options.world.objects.
xb-ai and the API-key guidance in AGENTS.md).
Take google/xb-world 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.