/// <summary> /// Requests for the hand mesh and executes the callback when the request is done. /// </summary> /// <param name="callback">Callback to execute when the request is done.</param> /// <returns> /// MLResult.Result will be <c>MLResult.Code.Ok</c> if successful. /// MLResult.Result will be <c>MLResult.Code.InvalidParam</c> if failed due to internal invalid input parameter. /// </returns> public static MLResult RequestHandMesh(RequestHandMeshCallback callback) { if (callback == null) { MLPluginLog.ErrorFormat("MLHandMeshing.RequestHandMesh failed. Reason: Passed input callback is null"); return(MLResult.Create(MLResult.Code.InvalidParam)); } ulong requestHandle = MagicLeapNativeBindings.InvalidHandle; MLResult.Code resultCode = NativeBindings.MLHandMeshingRequestMesh(Instance.nativeTracker, ref requestHandle); if (resultCode != MLResult.Code.Ok) { MLPluginLog.ErrorFormat("MLHandMeshing.RequestHandMesh failed to request hand mesh. Reason: {0}", resultCode); return(MLResult.Create(resultCode)); } Instance.pendingQueries.Add(new Query(requestHandle, callback)); return(MLResult.Create(resultCode)); }
/// <summary> /// Initializes a new instance of the <see cref="Query" /> class. /// </summary> /// <param name="reqHandle">The handle to the query request.</param> /// <param name="reqCallback">The callback to use when the query has a result.</param> public Query(ulong reqHandle, RequestHandMeshCallback reqCallback) { this.RequestHandle = reqHandle; this.RequestCallback = reqCallback; }