DeviceLocationTrackingComponent
ClassUsed to track a real-world location in a Lens.
- Available on all platforms
Index
Properties
Methods
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
readonlydistanceToLocation: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
isBeingDestroyed
readonlyisBeingDestroyed: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
isEnabledInHierarchy
readonlyisEnabledInHierarchy: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
readonlylocationProximityStatus: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
readonlysceneObject:SceneObject
The SceneObject this component is on.
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
destroy()
destroy():
void
Destroys the component.
Returns
void
Inherited from
getSceneObject()
getSceneObject():
SceneObject
Returns the SceneObject the component is attached to.
Returns
Inherited from
getTransform()
getTransform():
Transform
Returns the Transform this component is attached to.
Returns
Inherited from
getTypeName()
staticgetTypeName():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
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
Inherited from
isTracking()
isTracking():
boolean
Returns whether the location landmarker is currently being tracked.
Returns
boolean
See also
- Landmarkers guide.
- Custom Location AR guide.