A Layers object assigns an Object3D to 1 or more of 32 layers numbered 0 to 31 - internally the layers are stored as a bit mask, and by default all Object3Ds are a member of layer 0.

Remarks

This can be used to control visibility - an object must share a layer with a camera to be visible when that camera's view is rendered.

See

Constructors

  • Create a new Layers object, with membership initially set to layer 0.

    Returns Layers

Properties

mask: number

A bit mask storing which of the 32 layers this layers object is currently a member of.

Default Value

1 | 0

Remarks

Expects a Integer

Methods

  • Remove membership of this layer.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Remove membership from all layers.

    Returns void

  • Add membership of this layer.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Add membership to all layers.

    Returns void

  • Returns true if the given layer is enabled.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns boolean

  • Set membership to layer, and remove membership all other layers.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void

  • Returns true if this and the passed layers object have at least one layer in common.

    Parameters

    • layers: Layers

      A Layers object

    Returns boolean

  • Toggle membership of layer.

    Parameters

    • layer: number

      An integer from 0 to 31.

    Returns void