Cube
A unit 1×1×1 THREE.BoxGeometry mesh with a default white MeshStandardMaterial.
ts
import { Behaviour } from "@relu-interactives/spatial-ecs";
export default class SpawnCube extends Behaviour {
init() {
const objects = this.world.getObjectManagementSystem();
objects?.requestCreate("cube", {
name: "Crate",
transform: { position: { x: 0, y: 1, z: 0 } },
});
}
}Payload
| Field | Type | Default | Description |
|---|---|---|---|
name | string | "Cube" | Display name. |
transform | TransformData | identity | Position / rotation (radians) / scale. |
parentId | EntityId | null | null | Optional parent entity. |
Default size is 1 along each axis — adjust by changing transform.scale after spawn (e.g. getComponent(id, TransformComponent).scale.x = 2).
Components attached
Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Mesh, Material, MeshGeometry.

