TrackedMesh
ClassRepresents a mesh generated by world tracking.
- Available on all platforms
Represents a mesh generated by world tracking. Only available when world mesh tracking is supported and enabled.
Index
Properties
Methods
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);
}
}
Extends
Properties
isValid
readonlyisValid:boolean
Returns whether the tracked mesh is valid.
transform
readonlytransform:mat4
Returns the World Transformation matrix of the detected mesh.
Methods
getTypeName()
staticgetTypeName():TypeName<TrackedMesh>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<TrackedMesh>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean