Directional Light
A parallel-ray light source — like the sun. Casts shadows by default.
ts
import { Behaviour } from "@relu-interactives/spatial-ecs";
export default class SpawnSun extends Behaviour {
init() {
const objects = this.world.getObjectManagementSystem();
objects?.requestCreate("directionalLight", {
name: "Sun",
transform: { position: { x: 5, y: 8, z: 5 } },
});
}
}Payload
| Field | Type | Default | Description |
|---|---|---|---|
name | string | "Directional Light" | Display name. |
transform.position | { x, y, z } | (3, 6, 4) | Light position (direction is target − position). |
transform.rotation / scale | — | identity | Standard transform fields. |
parentId | EntityId | null | null | Optional parent entity. |
Default color #ffffff, intensity 1.5, castShadow: true.
Components attached
Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Light.

