public override IEnumerator StartDetection(GestureOption option) { #if VIVEHANDTRACKING_WITH_WAVEVR && !UNITY_EDITOR // retry at most 5 times if camera is not ready int count = 5; #else int count = 1; #endif while (count > 0) { State.Error = GestureInterface.StartGestureDetection(option); if (State.Error == GestureFailure.Camera && count > 1) { Debug.LogError("Start camera failed, retrying..."); yield return(new WaitForSeconds(0.5f)); count--; continue; } else if (State.Error != GestureFailure.None) { Debug.LogError("Start gesture detection failed: " + State.Error); State.Status = GestureStatus.Error; } else { State.Mode = option.mode; State.Status = GestureStatus.Starting; } break; } }
void StartGestureDetection() { if (Status == GestureStatus.Starting || Status == GestureStatus.Running) { return; } Error = GestureInterface.StartGestureDetection(option); if (Error != GestureFailure.None) { #if VIVEHANDTRACKING_WITH_WAVEVR WaveVR_Log.Log.e("Aristo", "Start gesture detection failed: " + Error); #else Debug.LogError("Start gesture detection failed: " + Error); #endif Status = GestureStatus.Error; } else { Mode = option.mode; HaveSkeleton = Mode == GestureMode.Skeleton; Status = GestureStatus.Starting; } }