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.
Recognize a tap gesture anywhere
Hello, I'm a bit new to Hololens development. I'm using the holotoolkit on Unity and I would like to be able to recognize a tap gesture anywhere. I followed the hologram courses but there are many things I don't know about C# so it's quite complicated for me, so I'm trying to figure it out using the holotoolkit's API.
Is there a way to recognize a tap gesture anywhere? Something simple like :
OnInputClicked(InputClickedEventData eventData)
{
//Do stuff
}
(I found that in TapToPlace.cs)
But this only works when the script is attached to an object and I have a scene with dozens of objects.
By the way, I do have an InputManager GameObject placed in my hierarchy.
Best Answer
-
One solution would be to add the following Start method to your script:
private void Start() { InputManager.Instance.PushFallbackInputHandler(gameObject); }
A fallback input handler is only called when no modal or focused objects consume the event. The InputManager has a lot of useful methods if you prefer different behaviour.
6
Answers
One solution would be to add the following Start method to your script:
A fallback input handler is only called when no modal or focused objects consume the event. The InputManager has a lot of useful methods if you prefer different behaviour.
Woah, it worked instantly ! Thank you very much !
For those wondering, here is the code I wrote :