LocationAsset
ClassProvides a frame of reference in which to localize objects to the real world.
- Available on all platforms
Provides a frame of reference in which to localize objects to the real world. Use with LocatedAtComponent.
Index
Properties
Methods
Example
// @input Asset.Texture myTexture
const currentObj = script.sceneObject;
const imageComponent = currentObj.createComponent(Image.getTypeName());
const imageMaterial = imageComponent.mainPass;
imageMaterial.baseTex = script.myTexture;
@component
export class AssetExample extends BaseScriptComponent {
@input()
myTexture: Texture;
onAwake() {
const currentObj = this.sceneObject
const imageComponent = currentObj.createComponent(Image.getTypeName());
const imageMaterial = imageComponent.mainPass;
imageMaterial.baseTex = this.myTexture;
}
}
Extends
Properties
name
name:
string
The name of the Asset in Lens Studio.
Default Value
""
Inherited from
uniqueIdentifier
readonlyuniqueIdentifier:string
Since
Lens Scripting Version 176
Inherited from
Methods
adjacentTile()
adjacentTile(
xOffset,yOffset,zoomOffset):LocationAsset
Returns the LocationAsset Tile that is specified by the containing tile and the specified xOffset, yOffset and zoomOffset. When zooming in, index offset is relative to the center. When zooming out or not zooming, index offset is relative to the containing tile.
Parameters
| Parameter | Type |
|---|---|
xOffset | number |
yOffset | number |
zoomOffset | number |
Returns
LocationAsset
Since
Lens Scripting Version 228
fromSerialized()
staticfromSerialized(serialized):LocationAsset
Exposes user dataSPECS
Deserialize the provided serialized LocationAsset.
Parameters
| Parameter | Type |
|---|---|
serialized | string |
Returns
LocationAsset
getAROrigin()
staticgetAROrigin():LocationAsset
Gets the origin position of the LocationAsset.
Returns
LocationAsset
Since
Lens Scripting Version 229
getGeoAnchoredPosition()
staticgetGeoAnchoredPosition(longitude,latitude):Anchor
Get an Anchor based on the given GPS coordinate.
Parameters
| Parameter | Type |
|---|---|
longitude | number |
latitude | number |
Returns
Since
Lens Scripting Version 172
getNearby()
staticgetNearby(xOffset,yOffset,zoomOffset):LocationAsset
Gets nearby LocationAsset tiles, where each argument represents the x,y,z position relative to the current LocationAsset.
Parameters
| Parameter | Type |
|---|---|
xOffset | number |
yOffset | number |
zoomOffset | number |
Returns
LocationAsset
Since
Lens Scripting Version 172
getProxy()
staticgetProxy(proxyId):LocationAsset
Get a Proxy LocationAsset with the proxyId embedded in the locationId. proxyId must not be null, must start with an alpha char, and consist only of alphanumerics or ".".
Parameters
| Parameter | Type |
|---|---|
proxyId | string |
Returns
LocationAsset
Since
Lens Scripting Version 191
getProxyId()
getProxyId():
string
Gets the Proxy LocationID if the LocationAsset is a proxyLocation; returns null otherwise. This is useful in instances where a callback may return a mix of different location assets, and the creator of the proxy asset has specific handling in mind for particular proxy locations.
Returns
string
Since
Lens Scripting Version 191
getTypeName()
staticgetTypeName():TypeName<LocationAsset>
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<LocationAsset>
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
toSerialized()
toSerialized():
string
Exposes user dataSPECS
Serialize the LocationAsset to a string representation.
Returns
string