microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

[master] Haptics doesn't work when running in-editor #1440

Closed keveleigh closed 6 years ago

keveleigh commented 6 years ago

Overview

The UWP haptics APIs are currently exposed in a way that makes them incompatible with running in the Unity editor.

My recommended fix would be by adding to the DLL (we can rename it to make it more accurate) I wrote to expose the motion controller model API, found in the MixedRealityTookit here.

Additional methods could be written, with identical code to lines 18-39, but then calling the haptics APIs like in the existing Toolkit extensions.

I initially experimented with this addition when writing the initial DLL, but remember being blocked around creating a TimeSpan object, without time at the time to fully investigate.

Expected Behavior

The haptics APIs work when running in the editor.

Actual Behavior

The haptics APIs only work in a deployed app.

Steps to reproduce

Run the MotionControllerTest scene and press grasp or menu to try to trigger haptics.

Unity Editor Version

All

Mixed Reality Toolkit Release Version

All

StephenHodgson commented 6 years ago

Any way we can extend this to also tie in haptics from non spatial controllers as well?

keveleigh commented 6 years ago

Yeah, maybe we can use the UWP GamePad Vibration APIs or the SimpleHapticsControllers from the UWP RawGameController APIs to expose haptics there as well.