Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Layers

场景节点层管理器,用于射线检测、物理碰撞和用户自定义脚本逻辑。 每个节点可属于一个或多个层,可通过 “包含式” 或 “排除式” 两种检测器进行层检测。

Hierarchy

  • Layers

Index

Properties

Static All

All: number = Layers.makeExclusiveMask([Layers.Gizmos, Layers.SceneGizmo, Layers.Editor])

接受所有用户创建的节点

Static Always

Always: number = 1 << 29

Static Default

Default: number = 1 << 30

默认层,所有节点的初始值

Static Editor

Editor: number = (1 << 22)

Static Gizmos

Gizmos: number = (1 << 21)

Static IgnoreRaycast

IgnoreRaycast: number = (1 << 20)

Static RaycastMask

RaycastMask: number = Layers.makeExclusiveMask([Layers.Gizmos, Layers.SceneGizmo, Layers.Editor, Layers.IgnoreRaycast])

接受所有支持射线检测的节点

Static SceneGizmo

SceneGizmo: number = (1 << 24)

Static UI

UI: number = (1 << 23)

Static Private _nextAvailable

_nextAvailable: number = 8

Methods

Static addLayer

  • addLayer(name: string): number | undefined

Static check

  • check(layer: number, mask: number): boolean
  • 检查一个层是否被检测器接受

    Parameters

    • layer: number

      待检测的层

    • mask: number

      层检测器

    Returns boolean

    是否通过检测

Static makeExclusiveMask

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

    Parameters

    • excludes: number[]

      将拒绝的层数组

    Returns number

    指定功能的层检测器

Static makeInclusiveMask

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

    Parameters

    • includes: number[]

      可接受的层数组

    Returns number

    指定功能的层检测器

Generated using TypeDoc