/// <summary> /// Creates the PCF game object. /// </summary> /// <param name="pcf">Pcf.</param> void AddPCFObject(MLPCF pcf) { if (!_pcfObjs.Contains(pcf.GameObj)) { GameObject repObj = Instantiate(_representativePrefab, Vector3.zero, Quaternion.identity); repObj.name = pcf.GameObj.name; repObj.transform.parent = pcf.GameObj.transform; _pcfObjs.Add(pcf.GameObj); } }
/// <summary> /// Bind this gameObject to a pcf /// </summary> /// <param name="pcf">The pcf to bind to</param> void BindToPCF(MLPCF pcf) { UnregisterPCFEventHandlers(); DestroyBinding(); Binding = MLContentBinder.BindToPCF(UniqueId, gameObject, pcf); MLPersistentStore.Save(Binding); NotifyChangeOfStatus(Status.BINDING_CREATED, MLResult.ResultOk); RegisterPCFEventHandlers(); _pcfLost = false; }
public static MLResult GetPCFPose(MLPCF pcf, Action <MLResult, MLPCF> callback) { if (pcf == null || callback == null) { MLResult result = MLResult.Create(MLResult.Code.InvalidParam, string.Format("invalid parameters. pcf: {0}, callback: {1}", pcf, callback)); MLPluginLog.ErrorFormat("MLPersistentCoordinateFrames.GetPCFPose failed. Reason: {0}", result); return(result); } else { MLResult result = pcf.Update(); callback(result, pcf); return(result); } }
/// <summary> /// Creates a binding between the virtual object and the specified PCF. /// </summary> /// <param name="virtualObjId">Virtual object identifier.</param> /// <param name="go">GameObject representing the virtual object. (Note: This is not serialized)</param> /// <param name="pcf">PCF to bind to</param> /// <returns> /// MLContentBinding object with mapping between virtual object and PCF. Please note that /// just calling this function is not enough to persist the binding. Call MLPersistentStore.Save to persist this mapping. /// </returns> public static MLContentBinding BindToPCF(string virtualObjId, GameObject go, MLPCF pcf) { if (pcf == null || go == null) { MLPluginLog.Error("MLContentBindings.BindToPCF failed, either GameObject or PCF is null."); return(null); } if (pcf.CurrentResult != MLResult.Code.Ok) { MLPluginLog.Error("MLContentBindings.BindToPCF failed, invalid PCF."); return(null); } MLContentBinding newBinding = new MLContentBinding(); newBinding.GameObject = go; newBinding.ObjectId = virtualObjId; newBinding.PCF = pcf; newBinding.BindingType = MLContentBindingType.PCF; newBinding.Update(); //MLPersistentCoordinateFrames.QueueForUpdates(newBinding.PCF); return(newBinding); }
public static void QueueForUpdates(MLPCF pcf) { QueueForUpdates((PCF)pcf); }
public static MLResult GetPCFPosition(MLPCF pcf, Action <MLResult, MLPCF> callback) { return(MLResult.Create(MLResult.Code.UnspecifiedFailure, "Please use MLPersistentCoordinateFrames.Update instead.")); }