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.

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.