Models and mapsGenerated geometry
Move a whole, or only its part
A bench made of its seat and legs: turn the bench and every part turns with it, change a part and only the part changes.
What this example defines: its scene and, where it has them, its simulated source and its styling. The page imports and runs this file; the page's own renderer, panels and controls are not in it. For a complete app to run on your machine, download the quickstart starter.
import { SceneObject } from "@klorad/react";
const plank = { kind: "box", width: 0.08, depth: 0.5, height: 0.45 } as const;
/**
* A compound object, declared: a bench as its whole (a group, drawn by its parts) and three parts,
* each a Scene Object of its own that names the bench in `partOf`. Turn or move the bench and its
* parts go with it; select a part and only the part changes.
*/
export function CompoundWorld() {
return (
<>
<SceneObject id="bench" name="Bench" position={{ east: 0, north: 0 }} geometry={{ kind: "group" }} />
<SceneObject id="seat" name="Seat" position={{ east: 0, north: 0, up: 0.45 }} geometry={{ kind: "box", width: 3, depth: 0.6, height: 0.08 }} color="#9a6a3a" partOf="bench" />
<SceneObject id="leg-west" name="West leg" position={{ east: -1.3, north: 0 }} geometry={plank} partOf="bench" />
<SceneObject id="leg-east" name="East leg" position={{ east: 1.3, north: 0 }} geometry={plank} partOf="bench" />
<SceneObject id="lamp" name="Lamp" position={{ east: 6, north: 3 }} geometry={{ kind: "cylinder", radius: 0.12, height: 3.5 }} />
</>
);
}Click a part, or select the bench, then move or turn it.
Anchor40.62637° N 22.94838° E
East, north+0.0 m +0.0 m
Digital ObjectDigital ShadowDigital TwinStale