/// <summary> /// Changes the state of the simulated motion controller. /// </summary> /// <param name="isSelecting">Whether the motion controller should be selecting something.</param> /// <param name="isGrabbing">Whether the motion controller should be grabbing something.</param> /// <param name="isPressingMenu">Whether the menu button of the motion controller should be pressed down.</param> /// <param name="waitForFixedUpdate">If true, waits for a fixed update after moving to the new state.</param> public IEnumerator SetState(SimulatedMotionControllerButtonState buttonStateNew, bool waitForFixedUpdate = true) { buttonState = buttonStateNew; for (var iter = PlayModeTestUtilities.MoveMotionController(position, position, buttonState, handedness, simulationService, 1); iter.MoveNext();) { yield return(iter.Current); } if (waitForFixedUpdate) { yield return(new WaitForFixedUpdate()); } }
/// <inheritdoc /> public override IEnumerator MoveTo(Vector3 newPosition, int numSteps = PlayModeTestUtilities.ControllerMoveStepsSentinelValue, bool waitForFixedUpdate = true) { Vector3 oldPosition = position; position = newPosition; for (var iter = PlayModeTestUtilities.MoveMotionController(oldPosition, newPosition, buttonState, handedness, simulationService, numSteps); iter.MoveNext();) { yield return(iter.Current); } if (waitForFixedUpdate) { yield return(new WaitForFixedUpdate()); } }