/// <summary> /// Shows multiple points at the same time and animates their blinking. /// </summary> private IEnumerator CalibrateDirectional_Arrows(int fromIndex, int toIndex) { timeSinceLastPoint = 0; direction = fromIndex > toIndex ? -1 : 1; if (useDirectionArrows && leftArrows && rightArrows) { leftArrows.SetBool("IsOn", direction > 0); rightArrows.SetBool("IsOn", direction < 0); } int i = fromIndex; while (i != toIndex) { Debug.Log("waiting for point " + i); SLAMInitializationGazePoint pCurrent = _points[i]; pCurrent.direction = -direction; pCurrent.allowGazing = true; pCurrent.Init(); pCurrent.Activate(true); currentTarget = pCurrent.r.transform; // wait until this point is detected (looked at for a minimum time set in the point prefab) while (pCurrent.isActive) { Debug.DrawLine(Vector3.zero, pCurrent.r.transform.position, Color.green); // check for early-out if slam calibration is fully done already if (CheckForSLAMInitComplete()) { timeSinceLastPoint = 0; yield break; } timeSinceLastPoint += Time.unscaledDeltaTime; yield return(null); } timeSinceLastPoint = 0; i += direction; } // wait for points to fade out }
/// <summary> /// Activates a single (invisible) point at a time and moves that around to have the user look at it. /// </summary> IEnumerator CalibrateDirectional_SinglePoint(int fromIndex, int toIndex) { timeSinceLastPoint = 0; direction = fromIndex > toIndex ? -1 : 1; leftArrows.SetBool("IsOn", direction > 0); rightArrows.SetBool("IsOn", direction < 0); int i = fromIndex; while (i != toIndex) { SLAMInitializationGazePoint pCurrent = _points[0]; // set point rotation var angle = Mathf.Lerp(fromAngle, toAngle, (float)i / (stepCountHalfCircle * 2 + 1)); pCurrent.transform.localRotation = Quaternion.Euler(0, angle, 0); // set up point for gazing pCurrent.direction = -direction; pCurrent.allowGazing = true; pCurrent.Init(); pCurrent.Activate(true); currentTarget = pCurrent.r.transform; // wait until point has been gazed at for long enough while (pCurrent.isActive) { // check for early-out if slam calibration is fully done already if (CheckForSLAMInitComplete()) { timeSinceLastPoint = 0; yield break; } timeSinceLastPoint += Time.unscaledDeltaTime; yield return(null); } timeSinceLastPoint = 0; i += direction; } }