TrackedPlane
ClassA representation for plane detected by native tracking.
- Available on all platforms
A representation for plane detected by native tracking. Can be used with TrackedPoint.
Index
Example
// @input Component.RenderMeshVisual renderMeshVisual
script.createEvent("WorldTrackingPlanesAddedEvent").bind(function (eventData) {
var eventPlanes = eventData.getPlanes();
for (var i = 0; i < eventPlanes.length; i++) {
var eventPlane = eventPlanes[i];
script.renderMeshVisual.mesh = eventPlane.mesh;
}
});
Extends
Properties
classification
readonlyclassification:TrackedPlaneClassification
SPECS only
The semantic class of the plane, see TrackedPlaneClassification. It can change as more of the plane is observed, see WorldTrackingPlanesUpdatedEvent.
Since
Lens Scripting Version 387
Example
//@input Component.DeviceTracking deviceTracking
//@input Component.RenderMeshVisual planeVisual
script.deviceTracking.worldOptions.nativePlaneTrackingType = NativePlaneTrackingType.Both;
script.deviceTracking.worldOptions.enablePlaneClassification = true;
var colors = {
[TrackedPlaneClassification.Wall]: new vec4(1, 0, 0, 1),
[TrackedPlaneClassification.Floor]: new vec4(1, 1, 0, 1),
[TrackedPlaneClassification.Table]: new vec4(0, 1, 0, 1),
};
// Show the last updated plane in the color of its class.
script.createEvent("WorldTrackingPlanesUpdatedEvent").bind(function (eventData) {
var plane = eventData.getPlanes()[0];
script.planeVisual.mesh = plane.mesh;
script.planeVisual.getSceneObject().getTransform().setWorldTransform(plane.transform);
script.planeVisual.mainPass.baseColor = colors[plane.classification] || new vec4(0.5, 0.5, 0.5, 1);
});
isValid
readonlyisValid:boolean
Whether the detected plane is still available to utilize
Since
Lens Scripting Version 144
mesh
readonlymesh:RenderMesh
A coarse mesh describing the shape of the tracked plane. Can be displayed by RenderMeshVisual
Since
Lens Scripting Version 144
orientation
readonlyorientation:TrackedPlaneOrientation
Returns the orientation of the detected plane, either vertical or horizontal.
Since
Lens Scripting Version 144
pivot
readonlypivot:vec3
The center point of the detected plane
Since
Lens Scripting Version 144
size
readonlysize:vec3
The size of the detected plane, where it is described as width, 0, depth
Since
Lens Scripting Version 144
transform
readonlytransform:mat4
The position, rotation, and scale of the detected plane
Since
Lens Scripting Version 144
Methods
getTypeName()
staticgetTypeName():TypeName<TrackedPlane>
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<TrackedPlane>
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