/// <inheritdoc /> public override void Update() { var profile = InputSimulationProfile; if (profile.IsCameraControlEnabled) { EnableCameraControl(); if (CameraCache.Main) { cameraControl.UpdateTransform(CameraCache.Main.transform); } } else { DisableCameraControl(); } if (profile.SimulateEyePosition) { // In the simulated eye gaze condition, let's set the eye tracking calibration status automatically to true InputSystem?.EyeGazeProvider?.UpdateEyeTrackingStatus(this, true); // Update the simulated eye gaze with the current camera position and forward vector InputSystem?.EyeGazeProvider?.UpdateEyeGaze(this, new Ray(CameraCache.Main.transform.position, CameraCache.Main.transform.forward), DateTime.UtcNow); } switch (profile.HandSimulationMode) { case HandSimulationMode.Disabled: DisableHandSimulation(); break; case HandSimulationMode.Articulated: case HandSimulationMode.Gestures: EnableHandSimulation(); if (UserInputEnabled) { handDataProvider.UpdateHandData(HandDataLeft, HandDataRight); } break; } }
/// <inheritdoc /> public override void Update() { var profile = InputSimulationProfile; if (profile.IsCameraControlEnabled) { EnableCameraControl(); if (CameraCache.Main) { cameraControl.UpdateTransform(CameraCache.Main.transform); } } else { DisableCameraControl(); } if (profile.SimulateEyePosition) { MixedRealityToolkit.InputSystem?.EyeGazeProvider?.UpdateEyeGaze(null, new Ray(CameraCache.Main.transform.position, CameraCache.Main.transform.forward), System.DateTime.UtcNow); } switch (profile.HandSimulationMode) { case HandSimulationMode.Disabled: DisableHandSimulation(); break; case HandSimulationMode.Articulated: case HandSimulationMode.Gestures: EnableHandSimulation(); if (UserInputEnabled) { handDataProvider.UpdateHandData(HandDataLeft, HandDataRight); } break; } }
/// <inheritdoc /> public override void Update() { base.Update(); var profile = InputSimulationProfile; switch (ControllerSimulationMode) { case ControllerSimulationMode.Disabled: DisableControllerSimulation(); break; case ControllerSimulationMode.ArticulatedHand: case ControllerSimulationMode.HandGestures: EnableHandSimulation(); break; case ControllerSimulationMode.MotionController: EnableMotionControllerSimulation(); break; } // If an XRDevice is present, the user will not be able to control the camera // as it is controlled by the device. We therefore disable camera controls in // this case. // This was causing issues while simulating in editor for VR, as the UpDown // camera movement is mapped to controller AXIS_3, which happens to be the // select trigger for WMR controllers. if (profile.IsCameraControlEnabled && !DeviceUtility.IsPresent) { EnableCameraControl(); } else { DisableCameraControl(); } UpdateMouseDelta(); if (UserInputEnabled) { if (dataProvider != null) { if (dataProvider is SimulatedHandDataProvider handDataProvider) { handDataProvider.UpdateHandData(HandDataLeft, HandDataRight, HandDataGaze, mouseDelta); } else if (dataProvider is SimulatedMotionControllerDataProvider controllerDataProvider) { controllerDataProvider.UpdateControllerData(MotionControllerDataLeft, MotionControllerDataRight, mouseDelta); } } if (cameraControl != null && CameraCache.Main != null) { cameraControl.UpdateTransform(CameraCache.Main.transform, mouseDelta); } } switch (EyeGazeSimulationMode) { case EyeGazeSimulationMode.Disabled: break; case EyeGazeSimulationMode.CameraForwardAxis: // In the simulated eye gaze condition, let's set the eye tracking calibration status automatically to true Service?.EyeGazeProvider?.UpdateEyeTrackingStatus(this, true); Service?.EyeGazeProvider?.UpdateEyeGaze(this, new Ray(CameraCache.Main.transform.position, CameraCache.Main.transform.forward), DateTime.UtcNow); break; case EyeGazeSimulationMode.Mouse: // In the simulated eye gaze condition, let's set the eye tracking calibration status automatically to true Service?.EyeGazeProvider?.UpdateEyeTrackingStatus(this, true); Service?.EyeGazeProvider?.UpdateEyeGaze(this, CameraCache.Main.ScreenPointToRay(UnityEngine.Input.mousePosition), DateTime.UtcNow); break; } }