Skip to main content

MarkerTrackingComponent

Class

Used to track images in the camera.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Index

Remarks

Moves the containing object's transform to match the detected image.

Example

//@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.");
}

Extends

Properties

autoEnableWhenTracking

autoEnableWhenTracking: boolean

If true, child objects of this Component's SceneObject will be disabled when the marker image is not being tracked.

Default Value

true

enabled

enabled: boolean

If disabled, the Component will stop enacting its behavior.

Default Value

true

Inherited from

Component.enabled


isBeingDestroyed

readonly isBeingDestroyed: boolean

Returns true if this Component is currently being destroyed. Becomes true as soon as destruction begins via Component#destroy or destruction of its owning SceneObject, before any OnDestroyEvent callbacks fire.

Since

Lens Scripting Version 364

Example

if (!script.isBeingDestroyed) {
// Component is still fully alive
}

Inherited from

Component.isBeingDestroyed


isEnabledInHierarchy

readonly isEnabledInHierarchy: boolean

Returns true if this Component, its SceneObject, and all of that SceneObjects parents are enabled.

Inherited from

Component.isEnabledInHierarchy


marker

marker: MarkerAsset

The marker asset describing the tracking target.

Default Value

null

onMarkerFound

onMarkerFound: () => void

A function that gets called when marker tracking begins.

Returns

void

Default Value

null

onMarkerLost

onMarkerLost: () => void

A function that gets called when marker tracking is lost.

Returns

void

Default Value

null

sceneObject

readonly sceneObject: SceneObject

The SceneObject this component is on.

Inherited from

Component.sceneObject


uniqueIdentifier

readonly uniqueIdentifier: string

Since

Lens Scripting Version 176

Inherited from

Component.uniqueIdentifier

Methods

destroy()

destroy(): void

Destroys the component.

Returns

void

Inherited from

Component.destroy


getSceneObject()

getSceneObject(): SceneObject

Returns the SceneObject the component is attached to.

Returns

SceneObject

Inherited from

Component.getSceneObject


getTransform()

getTransform(): Transform

Returns the Transform this component is attached to.

Returns

Transform

Inherited from

Component.getTransform


getTypeName()

static getTypeName(): TypeName<MarkerTrackingComponent>

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<MarkerTrackingComponent>

Overrides

Component.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Component.getTypeName


isOfType()

isOfType(type): boolean

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

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Component.isOfType


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

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Component.isSame


isTracking()

isTracking(): boolean

Returns whether the marker image is currently being tracked in camera.

Returns

boolean

See also

Marker Tracking guide.