Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layers

Node's layer manager, it's stored as bit mask data in Node.layer. Layer information is widely used in raycast, physics and user logic. Every node can be assigned to multiple layers with different bit masks, you can setup layer with inclusive or exclusive operation.

Hierarchy

  • Layers

Index

Properties

Static BitMask

BitMask: { ALL: number; DEFAULT: number; EDITOR: number; GIZMOS: number; IGNORE_RAYCAST: number; NONE: number; PROFILER: number; SCENE_GIZMO: number; UI_2D: number; UI_3D: number } = BitMask(Object.assign({}, layerList))

All layers in BitMask type

Type declaration

  • ALL: number
  • DEFAULT: number
  • EDITOR: number
  • GIZMOS: number
  • IGNORE_RAYCAST: number
  • NONE: number
  • PROFILER: number
  • SCENE_GIZMO: number
  • UI_2D: number
  • UI_3D: number

Static Enum

Enum: { ALL: number; DEFAULT: number; EDITOR: number; GIZMOS: number; IGNORE_RAYCAST: number; NONE: number; PROFILER: number; SCENE_GIZMO: number; UI_2D: number; UI_3D: number } = Enum(layerList)

All layers in an Enum

Type declaration

  • ALL: number
  • DEFAULT: number
  • EDITOR: number
  • GIZMOS: number
  • IGNORE_RAYCAST: number
  • NONE: number
  • PROFILER: number
  • SCENE_GIZMO: number
  • UI_2D: number
  • UI_3D: number

Methods

Static addLayer

  • addLayer(name: string, bitNum: number): void
  • Add a new layer, user can use layers from bit position 0 to 19, other bits are reserved.

    Parameters

    • name: string

      Layer's name

    • bitNum: number

      Layer's bit position

    Returns void

Static deleteLayer

  • deleteLayer(bitNum: number): void
  • Remove a layer, user can remove layers from bit position 0 to 19, other bits are reserved.

    Parameters

    • bitNum: number

      Layer's bit position

    Returns void

Static makeMaskExclude

  • makeMaskExclude(excludes: number[]): number
  • Make a layer mask accepting everything but the listed layers

    Parameters

    • excludes: number[]

      All excluded layers

    Returns number

    A filter which can detect for excluded layers

Static makeMaskInclude

  • makeMaskInclude(includes: number[]): number
  • Make a layer mask accepting nothing but the listed layers

    Parameters

    • includes: number[]

      All accepted layers

    Returns number

    A filter which can detect all accepted layers

Generated using TypeDoc