Microsoft Mixed Reality Controller Haptics

Hi,

Anyone got an example of how to make the hand controller rumble?

Thanks

http://lmgtfy.com/?q=microsoft+mixed+reality+controller+vibrate+unity

also https://blogs.unity3d.com/2017/09/05/looking-to-the-future-of-mixed-reality-part-i/

and the carte blanche project. They mention the touch API etc...

Sorry to be so "google it"-ish, but seriously, even just a quick google would have fruited many, many answers and different points of call. This question has also been asked on the microsoft hololens AND immersive apps forum as well as subreddits too.

Can you not just link to the relevant documentation page for motion controller haptics? I've been googling all day. I've got position and button data sorted, just need the rumble feature working.

Thanks

1 Like

For those still searching, the Mixed Reality Toolkit has an API for rumble (link). Note that as of this writing there is an open issue that causes rumble to NOT work in the Unity Editor (it crashes for me), but it works fine when deployed. Here's a super-simple code sample.

using UnityEngine;
using UnityEngine.XR.WSA.Input;
using HoloToolkit.Unity;

public class InputRumble : MonoBehaviour
{
    private void OnEnable()
    {
        InteractionManager.InteractionSourcePressed += InteractionManager_InteractionSourcePressed;
    }

    private void OnDisable()
    {
        InteractionManager.InteractionSourcePressed -= InteractionManager_InteractionSourcePressed;
    }

    private void InteractionManager_InteractionSourceReleased(InteractionSourceReleasedEventArgs obj)
    {
        // Subtle rumble on release
#if !UNITY_EDITOR
        obj.state.source.StartHaptics(0.25f, 0.25f);
#endif
    }

    private void InteractionManager_InteractionSourcePressed(InteractionSourcePressedEventArgs obj)
    {
        // Intense rumble on press
#if !UNITY_EDITOR
        obj.state.source.StartHaptics(1.0f, 1.0f);
#endif
    }
}
2 Likes


-1

This thread is in the top results for that very query. You've created an infinite loop!

1 Like

2018.3 release notes has this

Haptics APIs for VR controllers

We now provide APIs for triggering haptics on the Windows Mixed Reality headset controller, Vive controller through OpenVR, and Oculus Touch controllers. We’ll continue expanding platform support and creating more feature abstractions in future releases.

For anyone that finds this thread after browsing for a while without luck (like me), here is a working example of making a vibration pulse when hovering over an object with an ObjectManipulator attached.

using UnityEngine;
using Microsoft.MixedReality.Toolkit.UI;
using Microsoft.MixedReality.Toolkit.Input;

public class Vibration : MonoBehaviour
{
    ObjectManipulator _manipulator;

    private void Awake()
    {
        _manipulator = GetComponent<ObjectManipulator>();
        _manipulator.OnHoverEntered.AddListener(OnHoverEnter);
    }

    private void OnHoverEnter(ManipulationEventData data)
    {
        var hapticController = data?.Pointer?.Controller as IMixedRealityHapticFeedback;
        hapticController?.StartHapticImpulse(0.4f, 0.5f);
    }
}