Skip to content

Sprite

A camera-facing THREE.Sprite textured with an image. Always faces the active camera.

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

export default class SpawnIcon extends Behaviour {
  init() {
    const objects = this.world.getObjectManagementSystem();
    objects?.requestCreate("sprite", {
      name: "Marker",
      path: "/assets/images/marker.png",
      transform: { position: { x: 0, y: 2, z: 0 } },
    });
  }
}

Payload

FieldTypeDefaultDescription
namestring"Sprite"Display name.
pathstring""URL or local-asset path to the sprite image.
transformTransformDataidentityPosition / rotation / scale.
parentIdEntityId | nullnullOptional parent entity.

Components attached

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