private void UpdateStateEyeGaze(int numNearPointersActive, int numFarPointersActive) { // Only enable eye gaze as a pointer if there are no other near or far pointers active. bool isEyeGazePointerActive = numFarPointersActive == 0 && numNearPointersActive == 0; gazePointerState = isEyeGazePointerActive ? GazePointerState.GazePointerActive : GazePointerState.GazePointerInactive; }
private void UpdateStateEyeGaze(int numNearPointersActive, int numFarPointersActive) { // If there are any far pointers active while eye gaze is valid, then // eye gaze should be disabled. bool isEyeGazePointerActive = numFarPointersActive == 0; gazePointerState = isEyeGazePointerActive ? GazePointerState.GazePointerActive : GazePointerState.GazePointerInactive; }
/// <summary> /// Updates the state machine based on the number of near pointers, the number of far pointers, /// and whether or not eye gaze is valid. /// </summary> public void UpdateState(int numNearPointersActive, int numFarPointersActive, int numFarPointersWithoutCursorActive, bool isEyeGazeValid) { if (eyeGazeValid != isEyeGazeValid) { activateGazeKeywordIsSet = false; eyeGazeValid = isEyeGazeValid; } bool canGazeCursorShow = numFarPointersActive == 0 && numNearPointersActive == 0; switch (gazePointerState) { case GazePointerState.Initial: if (!canGazeCursorShow) { // There is some pointer other than the gaze pointer in the scene, assume // this is from a motion controller or articulated hand, and that we should // hide the gaze pointer gazePointerState = GazePointerState.GazePointerInactive; } break; case GazePointerState.GazePointerActive: if (!canGazeCursorShow) { activateGazeKeywordIsSet = false; gazePointerState = GazePointerState.GazePointerInactive; } break; case GazePointerState.GazePointerInactive: // Go from inactive to active if we say the word "select" if (activateGazeKeywordIsSet) { activateGazeKeywordIsSet = false; gazePointerState = GazePointerState.GazePointerActive; } if (canGazeCursorShow && numFarPointersWithoutCursorActive > 0) { activateGazeKeywordIsSet = false; gazePointerState = GazePointerState.GazePointerActive; } break; default: break; } }
public void UpdateState(int numNearPointersActive, int numFarPointersActive) { GazePointerState newState = gazePointerState; bool isMotionControllerOrHandUp = numFarPointersActive > 0 || numNearPointersActive > 0; switch (gazePointerState) { case GazePointerState.Initial: if (isMotionControllerOrHandUp) { // There is some pointer other than the gaze pointer in the scene, assume // this is from a motion controller or articulated hand, and that we should // hide the gaze pointer newState = GazePointerState.GazePointerInactive; } break; case GazePointerState.GazePointerActive: if (isMotionControllerOrHandUp) { newState = GazePointerState.GazePointerInactive; activateGazeKeywordIsSet = false; } break; case GazePointerState.GazePointerInactive: // Go from inactive to active if we say the word "select" if (activateGazeKeywordIsSet) { newState = GazePointerState.GazePointerActive; activateGazeKeywordIsSet = false; } break; default: break; } gazePointerState = newState; }