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.
Options

How to do the hold gesture without target?

Hello,

I have created a tool to draw in the scene, it works fine when I move a pencil but what I want to do is just to do the "hold" gesture in the void, like the drawing tool in Skype.

Do you know how to code the "Hold Recognizer" without using a FocusedGameObject?

Thank you in advance.

Tagged:

Best Answer

  • Options
    FrimyFrimy
    Answer ✓

    Hello, by hold gesture I just mean you pinch your fingers and move your hand, like when you are drawing in skype. I succeded using the latest holotoolkit, with a code that did not work for me with the old one:

        void Awake()
        {
            gestureRecognizer = new GestureRecognizer();
            gestureRecognizer.SetRecognizableGesture(GestureSettings.Hold)
            gestureRecognizer.HoldStartedEvent += OnHoldStartedEvent;
            gestureRecognizer.HoldCompletedEvent += OnHoldCompletedEvent;
            gestureRecognizer.HoldCanceledEvent += OnHoldCanceledEvent;
    
            gestureRecognizer.StartCapturingGestures();
        }
    

    Thank you for your help anyways! ^^

Answers

  • Options

    You can add a global handler which will happen regardless of whether or not there is a FocusedGameObject

    InputManager.Instance.AddGlobalListener(gameObject);

    You could also try a fallback handler which happens only if there is not a focusedGameObject. Refer to the InputManager for that as well.

    Taqtile

  • Options

    Thank you very much I did not know that, I will try and keep you informed!

  • Options

    I tried but I don't success. Can you give me more details if it does not bother you? Thank you very much.

  • Options

    Might be easier to show me where you are at as my setup may not match. Especially the class that is calling AddGlobalListener. What interfaces does it implement?

    And what do you mean by the hold gesture? I'm only familiar with navigate/manipulate.

    Taqtile

  • Options
    FrimyFrimy
    Answer ✓

    Hello, by hold gesture I just mean you pinch your fingers and move your hand, like when you are drawing in skype. I succeded using the latest holotoolkit, with a code that did not work for me with the old one:

        void Awake()
        {
            gestureRecognizer = new GestureRecognizer();
            gestureRecognizer.SetRecognizableGesture(GestureSettings.Hold)
            gestureRecognizer.HoldStartedEvent += OnHoldStartedEvent;
            gestureRecognizer.HoldCompletedEvent += OnHoldCompletedEvent;
            gestureRecognizer.HoldCanceledEvent += OnHoldCanceledEvent;
    
            gestureRecognizer.StartCapturingGestures();
        }
    

    Thank you for your help anyways! ^^

  • Options
    edited May 2017

    @Frimy

    Hi, I have been trying to use the hold gesture for one of my projects, but I haven't been able to implement it. I have modified the gesture input class
    of the holotoolkit similar to what you have posted. But I haven't been able to figure out how to implement these functions. Could you please explain how to implement the hold gesture.

    Thanks,
    Pranav Gadamsetty

  • Options

    Hello, I did not touch the Holotoolkit code, the code I wrote was in my own script! You create a new script, put the Awake function as I wrote it, and then create the functions OnHoldStartedEvent(), OnHoldCompletedEvent() and OnHoldCanceledEvent(). The code you put in these functions depend on what you want to do!

Sign In or Register to comment.