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.
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.
Options
Gesture Action on focused object
Mayee
✭
in Discussion
I followed Holograms 211 Gesture tutorial and everything works fine. Now I created a UI RawImage and added a tapped event script to change the Image. The event must fire only when I airtap over the RawImage else it should not change. With the script below the event is fired if i tap anywhere.
using UnityEngine;
using UnityEngine.VR.WSA.Input;
public class CubeManager : MonoBehaviour
{
GestureRecognizer recognizer;
public Canvas button; // Use this for initialization void Start () { recognizer = new GestureRecognizer(); recognizer.TappedEvent += Recognizer_TappedEvent; recognizer.StartCapturingGestures(); } private void Recognizer_TappedEvent(InteractionSourceKind source, int tapCount, Ray headRay) { var myGUITexture = Resources.Load("Change"); }
}
Could anyone help me with this?
0
Best Answer
-
Optionsmark_grossnickle ✭✭✭
Don't add a TappedEvent to the GestureRecognizer as that triggers on all air taps.
Instead make your class implement IInputClickHandler and make sure you have a collider on the gameObject it is attached to.
Taqtile
5
Answers
Don't add a TappedEvent to the GestureRecognizer as that triggers on all air taps.
Instead make your class implement IInputClickHandler and make sure you have a collider on the gameObject it is attached to.
Taqtile
@mark_grossnickle That worked for me. I appreciate your help