AnchorModule.AnchorSession
ClassYour connection to the anchor system for an area.
- Snapchat: not supported
- SPECS: fully supported
- Camera Kit Web: not supported
- Camera Kit Mobile: not supported
- SnapchatNot supported — Available on SPECS only
- SPECSFully supported
- Camera Kit WebNot supported — Available on SPECS only
- Camera Kit MobileNot supported — Available on SPECS only
Since Lens Scripting v376
Your connection to the anchor system for an area. Use it to create, save, delete, discover, and track anchors. Close it only when tracking is no longer required.
Index
Properties
Methods
Extends
Properties
area
readonlyarea:string
SPECS
The area this session is using, or null if it was opened without one.
Since
Lens Scripting Version 376
onAnchorNearby
readonlyonAnchorNearby:event1<Anchor,void>
SPECS
Called when a previously saved anchor is found nearby. Set it on an AnchorComponent to track it.
Since
Lens Scripting Version 376
Methods
clearAllAnchors()
clearAllAnchors():
Promise<void>
SPECS
Delete all saved anchors for this Lens, across every area.
Returns
Promise<void>
Since
Lens Scripting Version 376
clearArea()
clearArea():
Promise<void>
SPECS
Permanently delete the anchors this Lens saved in the session's area. Fails if the session has no area.
Returns
Promise<void>
Since
Lens Scripting Version 376
close()
close():
Promise<void>
SPECS
Close the session and stop tracking.
Returns
Promise<void>
Since
Lens Scripting Version 376
createWorldAnchor()
createWorldAnchor(
toWorldFromAnchor):Promise<WorldAnchor>
SPECS
Create an anchor at a world position (world-from-anchor). Set the returned Anchor on an AnchorComponent to start tracking.
Parameters
| Parameter | Type |
|---|---|
toWorldFromAnchor | mat4 |
Returns
Promise<WorldAnchor>
Since
Lens Scripting Version 376
deleteAnchor()
deleteAnchor(
anchor):Promise<void>
SPECS
Permanently delete a saved anchor. Tracking stops immediately.
Parameters
| Parameter | Type |
|---|---|
anchor | Anchor |
Returns
Promise<void>
Since
Lens Scripting Version 376
getTypeName()
staticgetTypeName():TypeName<AnchorSession>
SPECS
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<AnchorSession>
Since
Lens Scripting Version 376
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
resolveAnchor()
resolveAnchor(
anchorId):Promise<Anchor>
SPECS
Turn a saved anchor id (from Anchor.id) back into an anchor you can track.
Parameters
| Parameter | Type |
|---|---|
anchorId | string |
Returns
Promise<Anchor>
Since
Lens Scripting Version 376
saveAnchor()
saveAnchor(
anchor,options?):Promise<void>
SPECS
Save an anchor so it can be found again in later sessions via onAnchorNearby.
Parameters
| Parameter | Type |
|---|---|
anchor | Anchor |
options? | SaveOptions |
Returns
Promise<void>
Since
Lens Scripting Version 376