/// <summary> /// Replace the motion controller data with the given values. /// </summary> /// <returns>True if the motion controller data has been changed.</returns> /// <param name="isTrackedNew">True if the motion controller is currently tracked.</param> /// <param name="buttonStateNew">New set of states of buttons on the motion controller.</param> /// <param name="updater">Delegate to function that updates the position and rotation of the motion controller. The delegate is only used when the motion controller is tracked.</param> /// <remarks>The timestamp of the motion controller data will be the current time, see [DateTime.UtcNow](https://docs.microsoft.com/dotnet/api/system.datetime.utcnow?view=netframework-4.8).</remarks> public bool Update(bool isTrackedNew, SimulatedMotionControllerButtonState buttonStateNew, MotionControllerPoseUpdater updater) { bool motionControllerDataChanged = false; if (isTracked != isTrackedNew || buttonState != buttonStateNew) { isTracked = isTrackedNew; buttonState = buttonStateNew; motionControllerDataChanged = true; } if (isTracked) { MixedRealityPose pose = updater(); Position = pose.Position; Rotation = pose.Rotation; motionControllerDataChanged = true; } return(motionControllerDataChanged); }
/// <summary> /// Resets the states of buttons on the simulated controller. /// </summary> public void ResetButtonStates() { ButtonState = new SimulatedMotionControllerButtonState(); }