Skip to content

Spot Light

A cone-shaped light with adjustable angle, penumbra, and distance falloff.

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class SpawnSpot extends Behaviour {
  init() {
    const objects = this.world.getObjectManagementSystem();
    objects?.requestCreate("spotLight", {
      name: "Stage",
      transform: { position: { x: 0, y: 5, z: 0 } },
    });
  }
}

Payload

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

Default color #ffffff, intensity 1, distance 20, angle π/6, penumbra 0.1, decay 1.

Components attached

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