MarkerTrackingComponent
Lens Studio v1.7.0+
Scripting Name: Component.MarkerTrackingComponent
Inherits from Component
Description
Used to track images in the camera. Moves the containing object’s transform to match the detected image. For more information, see the Marker Tracking guide.
Methods
isTracking()
: Boolean
Returns whether the marker image is currently being tracked in camera.
Properties
autoEnableWhenTracking
: Boolean
If true, child objects of this Component’s SceneObject will be disabled when the marker image is not being tracked.
marker
: MarkerAsset
The marker asset describing the tracking target.
onMarkerFound
: function
A function that gets called when marker tracking begins.
onMarkerLost
: function
A function that gets called when marker tracking is lost.
Inherited Methods
destroy()
: void
Destroys the component.
getSceneObject()
: SceneObject
Returns the SceneObject the component is attached to.
getTransform()
: Transform
Returns the Transform this component is attached to.
isSame(SerializableWithUID other)
: Boolean
Returns true if this object is the same as other
. Useful for checking if two references point to the same thing.
getTypeName()
: String
Returns the name of this object’s type.
isOfType(String type)
: Boolean
Returns true if the object matches or derives from the passed in type.
Inherited Properties
enabled
: Boolean
If disabled, the Component will stop enacting its behavior.
Examples
//@input Component.MarkerTrackingComponent markerTrackingComponent
// Get whether or not the marker image is being tracked
var isMarkerTracking = script.markerTrackingComponent.isTracking();
// Print current status.
if (isMarkerTracking) {
print("Image is in Camera feed.");
} else {
print("Image is NOT in Camera feed.");
}
Still Looking for help?
Visit Support