ecspresso
    Preparing search index...

    Function createDetector

    • Create a detector component.

      Parameters

      • range: number

        Detection radius in world units

      • layerFilter: readonly string[]

        Only detect entities on these collision layers

      • maxResults: number = 32

        Maximum results to track (default: 32)

      Returns Pick<DetectionComponentTypes, "detector">

      Component object suitable for spreading into spawn()

      ecs.spawn({
      ...createDetector(300, ['enemy']),
      ...createLocalTransform(400, 400),
      });