public void CycleTargetPointLocation(int step) { int n = System.Enum.GetValues(typeof(ControllerTargetPointLocation)).Length; // num interfaces int r = (int)CurrentControllerTargetPointLocation + step; int new_idx = (r % n + n) % n; // mod function, handles negatives ControllerTargetPointLocation newLocation = (ControllerTargetPointLocation)(new_idx); CurrentControllerTargetPointLocation = newLocation; }
public void RefreshVisualization(InterfaceType newAlignmentInterfaceType, ControllerTargetPointLocation newControllerTargetPointLocation) { CurrentAlignmentInterfaceType = newAlignmentInterfaceType; CurrentControllerTargetPointLocation = newControllerTargetPointLocation; // hide all UIs, then enable the one we want HideAllInterfaces(); switch (CurrentAlignmentInterfaceType) { case InterfaceType._AxesSmallNoSphere: SetupAxes(InterfaceScale.Small, false); break; case InterfaceType._AxesSmallWithSphere: SetupAxes(InterfaceScale.Small, true); break; case InterfaceType._AxesLargeNoSphere: SetupAxes(InterfaceScale.Large, false); break; case InterfaceType._AxesLargeWithSphere: SetupAxes(InterfaceScale.Large, true); break; case InterfaceType._ProjectorNoSphere: SetupProjector(false); break; case InterfaceType._ProjectorWithSphere: SetupProjector(true); break; case InterfaceType._ProngsNoSphere: SetupProngs(false); break; case InterfaceType._ProngsWithSphere: SetupProngs(true); break; case InterfaceType._ProngsDynamicNoSphere: SetupProngsDynamic(false); break; case InterfaceType._ProngsDynamicWithSphere: SetupProngsDynamic(true); break; default: Debug.LogError("ControllerTargetPoint: unhandled interface type " + CurrentAlignmentInterfaceType); break; } }
void SetCurrentControllerTargetPointLocation(ControllerTargetPointLocation newLocation) { CurrentControllerTargetPointLocation = newLocation; Debug.Log("set CurrentControllerTargetPointLocation to " + CurrentControllerTargetPointLocation); Vector3 position = Vector3.zero; switch (CurrentControllerTargetPointLocation) { case ControllerTargetPointLocation.ControllerTip: position = new Vector3(0, -0.075f, 0.035f); break; case ControllerTargetPointLocation.GripCenter: position = new Vector3(0, 0, -0.075f); break; default: Debug.LogError("unhandled CurrentControllerTargetPointLocation: " + CurrentControllerTargetPointLocation); break; } LeftControllerParent.TargetPoint.transform.localPosition = position; RightControllerParent.TargetPoint.transform.localPosition = position; if (CurrentSpawnedPoseParent != null) { CurrentSpawnedPoseParent.TargetPoint.transform.localPosition = position; } UpdateControllerSticks(position); if (CurrentSpawnedPoseParent != null) { CurrentSpawnedPoseParent.TargetPoint.RefreshVisualization(CurrentAlignmentInterfaceType, CurrentControllerTargetPointLocation); } if (CurrentControllerParent != null) { CurrentControllerParent.TargetPoint.RefreshVisualization(CurrentAlignmentInterfaceType, CurrentControllerTargetPointLocation); } }
public void OnTargetSpawned(SpawnedPoseTargetPoint spawnedPoseTargetPoint, InterfaceType alignmentInterfaceType, ControllerTargetPointLocation controllerTargetPointLocation) { CurrentSpawnedPoseTargetPoint = spawnedPoseTargetPoint; RefreshVisualization(alignmentInterfaceType, controllerTargetPointLocation); }
public void OnTargetSpawned(ControllerTargetPoint controllerTargetPoint, InterfaceType alignmentInterfaceType, ControllerTargetPointLocation controllerTargetPointLocation) { this.transform.localPosition = controllerTargetPoint.transform.localPosition; CurrentControllerTargetPoint = controllerTargetPoint; RefreshVisualization(alignmentInterfaceType, controllerTargetPointLocation); }