5.3 Collections and shapes ​

Contract 2.0.0 · package sha256 a857eca95b35921109faf997094bb4192f12527d9d0fcd4be7e97f06425bad6e · generated from examples/section-5/5.03-collections-and-shapes.ts by services/onsite-scripter/scripts/build-contract-docs.mjs; edit the source, not this file.

Imports: values (has, validate, the Holo*Error classes, the pure helpers) from @holostep-configurators/runtime-client, types from @holostep-configurators/runtime-client/contract, /math and /testing names from those entries; boot from the runtime module the root's loadRuntimeAtFloor resolves to. A type your page defines is your app's: declare it there, never import it from the package.

ts
import type { Outline2D, PoseInput, Session } from '@holostep-configurators/runtime-client/contract';
declare const session: Session;
declare const signal: AbortSignal;
declare const floorOutline: Outline2D;                              // metres, in XZ
declare const tileUrl: string;
declare const walls: ReadonlyArray<{ index: number; length: number; height: number; pose: PoseInput }>;
const room = session.collection('room', { role: 'scenery', signal });
await room.set({ items: [
  { key: 'floor', kind: 'mesh', shape: { kind: 'polygon', outline: floorOutline },
    material: { maps: { baseColor: { url: tileUrl, sizeM: 0.6 } } } },
  ...walls.map((w) => ({ key: `wall-${w.index}`, kind: 'mesh' as const, meta: { wall: w.index },
    shape: { kind: 'box' as const, size: { x: w.length, y: w.height, z: 0.1 } }, at: w.pose })),
]});

Back to the examples · llms.txt