Lens Scripting API

    Class Material

    An asset that describes how visual objects should appear.

    Each Material is a collection of Pass which define the actual rendering passes. Materials are used by MaterialMeshVisual for drawing meshes in the scene.

    // Gets the first pass of a material on a sprite and plays the animation from its texture
    var sprite = script.getSceneObject().getFirstComponent("Component.SpriteVisual");
    var material = sprite.getMaterial(0);
    material.getPass(0).baseTex.control.play(-1,0.0);

    // Print number of passes
    print("Pass count = " + material.getPassCount().toString());

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    mainPass: Pass

    The first Pass of the Material.

    name: string

    The name of the Asset in Lens Studio.

    uniqueIdentifier: string

    Methods

    • Returns the Pass of the Material at index index.

      Parameters

      • index: number

      Returns Pass

    • Returns the number of Pass for the Material.

      Returns number

    • Returns the name of this object's type.

      Returns string

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

      Parameters

      Returns boolean

    MMNEPVFCICPMFPCPTTAAATR