Skip to content

Variable: XRMesh

const XRMesh: Component<{ _mesh: { default: any; type: Object; }; dimensions: { default: [number, number, number]; type: Vec3; }; isBounded3D: { default: false; type: Boolean; }; max: { default: [number, number, number]; type: Vec3; }; min: { default: [number, number, number]; type: Vec3; }; semanticLabel: { default: string; type: String; }; }>

Defined in: packages/core/src/scene-understanding/mesh.ts:44

Component representing detected real‑world 3D mesh geometry in AR/VR environments. This component should be attached to entities by the SceneUnderstandingSystem and be queried by custom systems.

Remarks

  • Automatically created by SceneUnderstandingSystem when meshes are detected.
  • Represents complex 3D geometry like furniture, objects, and room structure.
  • Supports both bounded 3D objects (furniture, objects) and global mesh (room structure).
  • Bounded meshes include semantic labels, bounding boxes, and calculated dimensions.
  • Global meshes represent overall room structure without semantic classification.
  • Entities are destroyed when the corresponding real‑world mesh is no longer detected.
  • Requires WebXR session with 'mesh‑detection' feature enabled.
  • Users should not manually create entities with this component and let the scene understanding system manage them.

Example

ts
your-system.query({ required: [XRMesh] }).subscribe('qualify', (entity) => {
  const isBounded = entity.getValue(XRMesh, 'isBounded3D')
  const semanticLabel = entity.getValue(XRMesh, 'semanticLabel')

  if (isBounded && semanticLabel === 'table') {
    console.log('Table detected!')
    const dimensions = entity.getValue(XRMesh, 'dimensions')
    console.log('Table size:', dimensions)
  }
})

See