Skip to content

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

FieldTypeDefaultDescription
namestring"Directional Light"Display name.
transform.position{ x, y, z }(3, 6, 4)Light position (direction is target − position).
transform.rotation / scaleidentityStandard transform fields.
parentIdEntityId | nullnullOptional parent entity.

Default color #ffffff, intensity 1.5, castShadow: true.

Components attached

Transform, Object3DRef, Name, EntityType, ParentId, Selectable, Light.