void ManipulationTranslate_ManipulationUpdated(SpatialGestureRecognizer sender, SpatialManipulationUpdatedEventArgs args) { var data = args.TryGetCumulativeDelta(referenceFrame.CoordinateSystem); if (data != null) { var vector = new Vector3(data.Translation.X, data.Translation.Y, -data.Translation.Z); Application.InvokeOnMain(() => app.OnGestureManipulationUpdated(vector)); } }
private void OnGestureManipulationUpdated(SpatialGestureRecognizer sender, SpatialManipulationUpdatedEventArgs args) { if (this.ManipulationUpdatedEvent != null) { WaveForegroundTask.Run(() => { this.ManipulationUpdatedEvent( this.service, (SpatialSource)args.InteractionSourceKind, args.TryGetCumulativeDelta(this.CoordinateSystem).Translation.ToWave(), this.mixedRealityApplication.HeadRay); }); } }
// Summary: // Handler for manipulation updated events. Stores relative offsets for later processing. private void OnManipulationUpdated(object sender, SpatialManipulationUpdatedEventArgs e) { // Get the manipulation delta relative to the frame of reference from when the manipulation began // Using a stationary frame of reference prevents movements of the device from affecting the gesture offset try { SpatialManipulationDelta manipulationDelta = e.TryGetCumulativeDelta(stationaryFrameOfReference.CoordinateSystem); // Store the offset lastGestureOffset = manipulationDelta.Translation; } catch { // If TryGetCumulativeDelta throws an exception, clear and disarm ClearSetpointsAndDisarm(); } }