Hello everyone.

We have decided to phase out the Mixed Reality Forums over the next few months in favor of other ways to connect with us.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

The plan between now and the beginning of May is to clean up old, unanswered questions that are no longer relevant. The forums will remain open and usable.

On May 1st we will be locking the forums to new posts and replies. They will remain available for another three months for the purposes of searching them, and then they will be closed altogether on August 1st.

So, where does that leave our awesome community to ask questions? Well, there are a few places we want to engage with you. For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality. If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers. And always feel free to hit us up on Twitter @MxdRealityDev.

Detecting if Airtap is tapped/hold regardless of gaze

I currently detect a held Airtap using the iHoldHandler and "OnHoldStarted"/"OnHoldCompleted" on a GameObject. However, this means the release of the Airtap is only detected when releasing it while gazing at that object.

How can I always detect the release of an held Airtap, regardless of the gaze? Similar to that: how do I detect an Airtap click when not looking at any detectable object?

Thanks

Tagged:

Best Answer

Answers

  • mGravitusmGravitus
    edited September 2017

    Detect an airtap when not looking at any object : use modal input.

    Release of airtap held airtap when not focused - same thing (modal)

    Events are consumed:

    Modal
    Focused Object
    FallBack

    You could also check for when hands are no longer detected and consider that as an airtap release (which sounds like what you want to solve).

    Hope this helps!

    Src:
    https://github.com/Microsoft/MixedRealityToolkit-Unity/issues/277

  • I use this code in my projects:

    GestureRecognizer gr = null;
    
    void Start () {
        gr = new GestureRecognizer();
        gr.TappedEvent += Tap;
        gr.StartCapturingGestures();
    }
    
    private void Tap(InteractionSourceKind source, int tapCount, Ray headRay)
    {
        Debug.Log("tap");
    }
    
  • For current versions of the MRTK, check out how it is done in OverrideFocusedObjectTest.unity and TestOverrideFocusedObject.cs. See https://github.com/Microsoft/MixedRealityToolkit-Unity/blob/master/Assets/HoloToolkit/Input/README.md

Sign In or Register to comment.