/// <summary> /// Explicitly set the managing IOrienter, overriding any setting from the Inspector. /// </summary> /// <param name="iorenter"></param> /// <remarks> /// The Orienter is nominally a completely internal artifact. The public setter is to allow /// construction from script. /// </remarks> public void SetOrienter(IOrienter iorienter) { this.iorienter = iorienter; // If of an appropriate type, assign to the serialized orienter field as well. if (iorienter is Orienter) { orienter = iorienter as Orienter; } }
/// <summary> /// Adopt the Inspector set Orienter as the interface iorienter. /// </summary> protected override void Start() { base.Start(); if (orienter != null) { iorienter = orienter; } }
/// <summary> /// Create a shared orienter, and create space pins for any spacePinPoints set in the inspector. /// </summary> protected override void Start() { base.Start(); orienter = gameObject.AddComponent <Orienter>(); CreateSpacePins(); radioSet = gameObject.GetComponentInChildren <InteractableToggleCollection>(); }
/// <summary> /// Ensure all required components exist and cache references where appropriate. /// </summary> private void CheckComponents() { if (miniManager == null) { miniManager = GetComponent <QRCodeMiniManager>(); } if (orienter == null) { if (sharedOrienter == null) { orienter = gameObject.AddComponent <Orienter>(); } else { orienter = sharedOrienter; } } }
public IEnumerator SaveLoadTestSpacePinOrientable() { GameObject rig = loadHelper.LoadBasicSceneRig(); GameObject[] gos = new GameObject[pinData.Length]; SpacePinOrientable[] spos = new SpacePinOrientable[pinData.Length]; Quaternion rotThirty = Quaternion.AngleAxis(30.0f, new Vector3(0.0f, 1.0f, 0.0f)); GameObject orienterGO = new GameObject("Orienter"); IOrienter orienter = orienterGO.AddComponent <Orienter>(); for (int i = 0; i < pinData.Length; ++i) { gos[i] = new GameObject("GOs_" + i.ToString()); spos[i] = gos[i].AddComponent <SpacePinOrientable>(); spos[i].Orienter = orienter; } /// Wait for their Start's to be called. yield return(null); for (int i = 0; i < spos.Length; ++i) { spos[i].transform.SetGlobalPose(pinData[i].virtualPose); spos[i].ResetModelingPose(); Vector3 rotPosition = rotThirty * pinData[i].virtualPose.position; spos[i].SetFrozenPosition(rotPosition); } yield return(null); IAlignmentManager alignMgr = WorldLockingManager.GetInstance().AlignmentManager; /// This is an arbitrary position, not actually one of the pinned positions currently. alignMgr.ComputePinnedPose(new Pose(pinData[0].lockedPose.position, Quaternion.identity)); Quaternion rot = Quaternion.Inverse(alignMgr.PinnedFromLocked.rotation); bool isThirty = rot == rotThirty; Assert.IsTrue(isThirty); GameObject.Destroy(rig); yield return(null); }
/// <summary> /// Ensure all required components exist and cache references where appropriate. /// </summary> private void CheckComponents() { if (spacePinningService == null) { spacePinningService = MixedRealityToolkit.Instance.GetService <ISpatialPinningService>(); spacePinningService?.Enable(); } if (orienter == null) { if (sharedOrienter == null) { orienter = gameObject.AddComponent <Orienter>(); } else { orienter = sharedOrienter; } } }
/// <summary> /// Explicitly set the managing IOrienter, overriding any setting from the Inspector. /// </summary> /// <param name="iorenter"></param> /// <remarks> /// The Orienter is nominally a completely internal artifact. The public setter is to allow /// construction from script. /// </remarks> public void SetOrienter(IOrienter iorienter) { this.iorienter = iorienter; }
public Orienter(IOrienter orienter) { _orienter = orienter; }