Exposes

user data

Description

Asset for detecting an object through the Scan system.

Example

//@input Asset.ScanModule scanModule
//@input Asset.Texture someTexture

function scanComplete(json)
{
var obj = JSON.parse(json);
var annotations = obj["annotations"][ScanModule.Contexts.Objects]["annotations"];
if(annotations.length > 0 && annotations[0].confidence > 0.95)
{
print("Scan found: " + annotations[0].name);
}
}

function onFailure(reason)
{
print("Scan failure: " + reason);
}

//if not filled via GUI
script.scanModule.targetTexture = script.someTexture;

script.createEvent("LongPressStartEvent").bind(function() {
script.scanModule.scan([ScanModule.Contexts.Objects], scanComplete, onFailure);
});
interface ScanModule {
    name: string;
    scanTarget: Texture;
    uniqueIdentifier: string;
    getTypeName(): string;
    isOfType(type): boolean;
    isSame(other): boolean;
    scan(contexts, scanComplete, scanFailed): void;
}

Hierarchy (view full)

Properties

name: string

Description

The name of the Asset in Lens Studio.

scanTarget: Texture

Description

Optional property to pass in a texture for Scan to use.

uniqueIdentifier: string

Methods

  • Returns string

    Description

    Returns the name of this object's type.

  • Parameters

    • type: string

    Returns boolean

    Description

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

  • Parameters

    Returns boolean

    Description

    Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

  • Parameters

    • contexts: string[]
    • scanComplete: ((resultJson) => void)
        • (resultJson): void
        • Parameters

          • resultJson: string

          Returns void

    • scanFailed: ((failureMessage) => void)
        • (failureMessage): void
        • Parameters

          • failureMessage: string

          Returns void

    Returns void

    Description

    Starts a single Scan call using the provided list of ScanModule.Contexts. On success it will invoke scanComplete providing a JSON string. On failure it will invoke onFailure with a failure message passed in as an argument.

Generated using TypeDoc