private void HandlePCFStatusChange(MLPersistentCoordinateFrames.PCF.Status pcfStatus, MLPersistentCoordinateFrames.PCF pcf) { if (_sharedPCF != null && pcf.CFUID == _sharedPCF.CFUID) { //our shared pcf updated: Reorient(); } }
//Event Handlers: private void HandlePCFChanged(MLPersistentCoordinateFrames.PCF.Status pcfStatus, MLPersistentCoordinateFrames.PCF pcf) { if (pcfAnchor != null && pcf.CFUID == pcfAnchor.CFUID) { //adjust to pcf: pcfAnchor.Update(); AnchorToPCF(); FireOnUpdated(); } }
/// <summary> /// Handler for PCF status changes. /// </summary> /// <param name="pcfStatus">The PCF status.</param> /// <param name="pcf">The PCF.</param> private void HandlePCFStatusChange(MLPersistentCoordinateFrames.PCF.Status pcfStatus, MLPersistentCoordinateFrames.PCF pcf) { switch (pcfStatus) { // Creates a new gameobject to represent the newly created pcf. case MLPersistentCoordinateFrames.PCF.Status.Created: { #if PLATFORM_LUMIN GameObject pcfVisual = Instantiate(pcfVisualPrefab, pcf.Position, pcf.Rotation, transform); _pcfVisuals.Add(pcfVisual); pcfVisual.SetActive(IsVisualizing); #endif break; } } }
// // The status of the PCF subsystem and all PCFs for the localized map // private void onStatusChange(MLPersistentCoordinateFrames.PCF.Status pcfStatus, MLPersistentCoordinateFrames.PCF pcf) { // Retain our status so we can change the color of the cube if (pcf.CFUID == this.coordinateFrameUID) { this.status = pcfStatus; } /// /// Comment out the code below to print out the status for information purposes /// There is no need to adjust the position or rotation of the GameObject, since the /// TransformBinding will automatically adjust that for us. /// //switch (pcfStatus) //{ // case MLPersistentCoordinateFrames.PCF.Status.Lost: // print("MLPersistentCoordinateFrames.PCF.Status.Lost"); // break; // case MLPersistentCoordinateFrames.PCF.Status.Created: // print("MLPersistentCoordinateFrames.PCF.Status.Created"); // break; // case MLPersistentCoordinateFrames.PCF.Status.Updated: // print("MLPersistentCoordinateFrames.PCF.Status.Updated"); // break; // case MLPersistentCoordinateFrames.PCF.Status.Regained: // print("MLPersistentCoordinateFrames.PCF.Status.Regained"); // break; // case MLPersistentCoordinateFrames.PCF.Status.Stable: // { // print("MLPersistentCoordinateFrames.PCF.Status.Stable"); // } // break; // default: // print("MLPersistentCoordinateFrames status unknown"); // break; //} }
private void OnStatusChange(MLPersistentCoordinateFrames.PCF.Status pcfStatus, MLPersistentCoordinateFrames.PCF pcf) { if (displayDebugVisuals) { if (pcfStatus == MLPersistentCoordinateFrames.PCF.Status.Created) { PCFAnchorVisual newVisual = Instantiate(AnchorVisualPrefab, pcf.Position, pcf.Rotation); newVisual.transform.parent = visualParent.transform; newVisual.GetComponent <PCFAnchorVisual>().PCF = pcf; } if (pcfStatus == MLPersistentCoordinateFrames.PCF.Status.Lost) { foreach (var visual in visualParent.GetComponentsInChildren <PCFAnchorVisual>()) { if (visual.PCF.Equals(pcf)) { DestroyImmediate(visual.gameObject); } } } if (pcfStatus == MLPersistentCoordinateFrames.PCF.Status.Updated) { foreach (var visual in visualParent.GetComponentsInChildren <PCFAnchorVisual>()) { if (visual.PCF.Equals(pcf)) { visual.gameObject.transform.position = pcf.Position; visual.gameObject.transform.rotation = pcf.Rotation; Debug.LogFormat("PCF Updated anchor: was {0}, is now {1}", visual.PCF.ToString(), pcf.ToString()); visual.PCF = pcf; } } } } }