Skip to main content

DeviceLocationTrackingComponent

Class

Used to track a real-world location in a Lens.

  • 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

Example

//@input Component.DeviceLocationTrackingComponent locationTrackingComponent

// Get whether or not the landmarker is being tracked
var isLocationTracking = script.locationTrackingComponent.isTracking();

// Print current status.
if (isLocationTracking) {
print("Location is being tracked");
} else {
print("Location is not being tracked");
}

Extends

Properties

distanceToLocation

readonly distanceToLocation: number

Returns the distance, in meters, to the location. If the distance is unavailable, -1 is returned.


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


location

location: LocationAsset

The location that the tracker is tracking. Useful for dynamically controlling the target location being tracked.

Since

Lens Scripting Version 209

Default Value

null

locationProximityStatus

readonly locationProximityStatus: LocationProximityStatus

Returns the user's current LocationProximityStatus. Useful for telling if a user is close enough to the location to track it.


onLocationDataDownloaded

onLocationDataDownloaded: () => void

A function that gets called when location data is downloaded.

Returns

void

Default Value

null

onLocationDataDownloadFailed

onLocationDataDownloadFailed: () => void

A function that gets called when location data fails to download.

Returns

void

Default Value

null

onLocationFound

onLocationFound: () => void

A function that gets called when location is found.

Returns

void

Default Value

null

onLocationLost

onLocationLost: () => void

A function that gets called when location is lost. Note this will also happen when the user flips the camera.

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

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

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 location landmarker is currently being tracked.

Returns

boolean

See also