Lens Scripting API

    Class TrackedMesh

    Represents a mesh generated by world tracking. Only available when world mesh tracking is supported and enabled.

    script.createEvent("WorldTrackingMeshesAddedEvent").bind(onMeshesAdded);

    function onMeshesAdded(eventData) {
    var trackedMeshes = eventData.getMeshes();
    print(trackedMeshes.length + " meshes were added");

    for (var i = 0; i < trackedMeshes.length; i++) {
    print("TrackedMesh is valid " + trackedMeshes[i].isValid);
    print("Transformation matrix " + trackedMeshes[i].transform);
    var m = trackedMeshes[i].transform;

    var pos = m.column3;
    print("Position " + pos);

    var rot = quat.lookAt(
    new vec3(m.column2.x,m.column2.y,m.column2.z),
    new vec3(m.column1.x,m.column1.y,m.column1.z)
    );
    print("Rotation " + rot);
    var s = new vec3(
    m.column0.length,
    m.column1.length,
    m.column2.length
    );
    print("Scale " + s);
    }
    }

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    isValid: boolean

    Returns whether the tracked mesh is valid.

    transform: mat4

    Returns the World Transformation matrix of the detected mesh.

    Methods

    • 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