Description

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

Example

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);
}
}
interface TrackedMesh {
    isValid: boolean;
    transform: mat4;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
}

Hierarchy (view full)

Properties

isValid: boolean

Description

Returns whether the tracked mesh is valid.

transform: mat4

Description

Returns the World Transformation matrix of the detected mesh.

Methods

  • Returns string

    Description

    Returns the name of this object's type.

  • Parameters

    • type: string

    Returns boolean

    Description

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

  • Parameters

    Returns boolean

    Description

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

Generated using TypeDoc