Preparing search index...

    Class GltfAsset

    Represents a GLTF 3D Model.

    // @input Asset.BitmojiModule bitmojiModule
    // @input Asset.RemoteMediaModule remoteMediaModule
    // @input Asset.Material pbrMaterialHolder

    script.bitmojiModule.requestBitmoji3DResource(
    function (bitmoji3DResource) {
    script.remoteMediaModule.loadResourceAsGltfAsset(
    bitmoji3DResource,
    onDownloaded,
    onFail
    )
    }
    )

    function onDownloaded (gltfAsset){
    var root = scene.createSceneObject("BitmojiAvatar");
    var gltfSettings = GltfSettings.create();
    gltfSettings.convertMetersToCentimeters = true;
    var avatar = gltfAsset.tryInstantiateWithSetting(root, script.pbrMaterialHolder, gltfSettings);
    }

    function onFail (e){
    print(e);
    }

    Hierarchy (View Summary)

    Index

    Properties

    extras: string
    name: string

    The name of the Asset in Lens Studio.

    uniqueIdentifier: string

    Methods

    • Use this method to get a dynamic resource for the url from the gltf extras.

      Parameters

      • url: string

      Returns DynamicResource

    • Returns a JSON string containing statistics about the glTF asset including: file size, triangle count, vertex count, mesh count, texture count, texture memory size, material count, animation count, and node count. Must be called after the asset has been instantiated with tryInstantiate, tryInstantiateAsync or tryInstantiateWithSetting, otherwise it returns null.

      Returns string

      var info = gltfAsset.getStaticComposition();
      if (info) {
      var stats = JSON.parse(info);
      print("Triangles: " + stats.triangleCount);
      print("File size: " + stats.fileSizeBytes + " bytes");
      }
    • Returns the name of this object's type.

      Returns string

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

      Parameters

      • type: string

      Returns boolean

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

      Parameters

      Returns boolean

    • Asynchronously try instantiating an object from the GLTF asset. Useful to prevent frame drops when loading multiple assets simultaenously as to not block the the thread.

      Parameters

      Returns void