Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layers

节点层管理器,层数据是以掩码数据方式存储在 Node.layer 中,用于射线检测、物理碰撞和用户自定义脚本逻辑。 每个节点可属于一个或多个层,可通过 “包含式” 或 “排除式” 两种检测器进行层检测。

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))

包含所有层的 BitMask

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)

以 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
  • 添加一个新层,用户可编辑 0 - 19 位为用户自定义层

    Parameters

    • name: string

      Layer's name

    • bitNum: number

      Layer's bit position

    Returns void

Static deleteLayer

  • deleteLayer(bitNum: number): void

Static makeMaskExclude

  • makeMaskExclude(excludes: number[]): number
  • 创建一个排除式层检测器,只拒绝列表中的层

    Parameters

    • excludes: number[]

      All excluded layers

    Returns number

    A filter which can detect for excluded layers

Static makeMaskInclude

  • makeMaskInclude(includes: number[]): number
  • 创建一个包含式层检测器,只接受列表中的层

    Parameters

    • includes: number[]

      All accepted layers

    Returns number

    A filter which can detect all accepted layers

Generated using TypeDoc