Lens Scripting API

    Class LayerSet

    Used to describe a set of layers that an object belongs to or interacts with.

    Check if a Camera will render this SceneObject

    // @input Component.Camera camera

    // Check if the camera will render this SceneObject
    var cameraLayer = script.camera.renderLayer;
    var objectLayer = script.getSceneObject().layer;

    var intersection = cameraLayer.intersect(objectLayer);

    if (intersection.isEmpty()) {
    print("camera won't render this object");
    } else {
    print("camera will render this object");
    }

    Add this SceneObject's layer to a Camera's render layer, so that the camera will render it.

    // @input Component.Camera camera

    // Add this SceneObject's layer to a Camera's render layer
    var objectLayer = script.getSceneObject().layer;
    script.camera.renderLayer = script.camera.renderLayer.union(objectLayer);

    Create a new LayerSet based on a number

    // Create a LayerSet based on 0
    var layerSet = LayerSet.fromNumber(0);
    Index

    Constructors

    Properties

    numbers: number[]

    Methods

    • Returns true if all layers in the other LayerSet are also present in this one.

      Parameters

      Returns boolean

    • Returns a new LayerSet that contains layers present in this LayerSet but not present in other.

      Parameters

      Returns LayerSet

    • Returns a new LayerSet based on the passed in number.

      Parameters

      • layerId: number

      Returns LayerSet

    • Returns a new LayerSet that only contains layers present in both this LayerSet and other.

      Parameters

      Returns LayerSet

    • Returns true if this LayerSet contains no layers.

      Returns boolean

    • Creates a new LayerSet that is guaranteed to be empty and not intersect existing layers. This bypasses the normal 32 layer limit in Studio, allowing for around 65,000 unique layers.

      Returns LayerSet

    • Returns a string representation of this LayerSet.

      Returns string

    MMNEPVFCICPMFPCPTTAAATR