Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

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.

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, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Detect source of a click event (AirTap and Clicker)

Hi,
I would like to only detect click events of the Hololens Clicker (not Air Tap).
I'm currently using OnInputClicked function :
public void OnInputClicked(InputClickedEventData eventData)
{
//Do stuff
}
But this code detects all kinds of click events, is it possible to distinguish "click on clicker" and Air Tap with hand ?
I've tried :
InteractionSourceInfo sourceInfo;
eventData.InputSource.TryGetSourceKind(eventData.SourceId, out sourceInfo);
But sourceInfo is always equal to "Other".
Thanks,

Tagged:

Answers

  • dbarrettdbarrett ✭✭✭

    Is sourceInfo equal to other when using the clicker or when using your hand or both? It should return hand when using your hand and other when using the clicker.

    You could always try TryGetPointerPosition. I believe that is the name of the method. It returns true when the user clicks with their hand and not with a pointer.

    AR Developer

  • I've tried TryGetPointerPosition, but it didn't work.
    Both TryGetPointerPosition and TryGetSourceKind return False when I'm using the clicker AND the hand

  • edited March 2018

    I'm doing it this way:

        ...
            public void OnInputDown(InputEventData eventData)
            {
    
        #if !UNITY_EDITOR
                Vector3 ps = Vector3.zero;
                bool ret = eventData.InputSource.TryGetPosition(eventData.SourceId, out ps);
                if(ret) return;  // if we can get a position its' hand - else it's a clicker ! (clicker has no position)
        #endif
                buttonPressed = true;   // it's a global
            }
        ....
    

    Hope this helps

Sign In or Register to comment.