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

Respond to tap event

I am trying to figure out how to respond to a tapped event...I can do it in the Hololens Academy, but apperently that code/example is out of date, and so I wanted to use the Hololens Toolkit...

I added the GesturesInput to my hologram, and it fires a RaiseSourceClickedEvent() on an airtap...great. Now, how do I respond to that? I assume I add another script to the object that I want to respond to the airtapped event, but I have no idea...One thought is to modify the GesturesInput.cs to do what I want, but then I will need to add that script to every object that responds to a GesturesInput, maybe that's ok, but it seems like there's a better way and the example with "out-of-date" code uses a listener to call FocusedObject.SendMessageUpwards("OnSelect");

On a side note, is it just me that thinks the out of date tutorials are frustrating? There seems to be a lack of up-to-date "how-to" out there...sure there's an API, but for those of us just beginning, that's a little too vague and using out of date code feels second-rate...anyway, just a thought.

Best Answer

  • Options
    Answer ✓

    Hi @toddfielder. First, yes, we are all frustrated at out of date tutorials. You are not alone there at all. That said, It would be a full time job keeping the tutorials up to date with as fast as the HoloToolkit is changing. The input stuff you are working with is literally brand new within the last two weeks. It's also really, really awesome.

    It sounds like you are halfway there as it is. The remaining part you need to do is create a new script that will be attached to your object, and have it implement the appropriate interface documented in the input module readme. In your particular case, I believe you are looking for IInputClickHandler. That should handle the RaiseSourceClickedEvent().

    If you need further info, please let me know. Also. take a look at the readme under the input folder in the HTK, it's actually very well documented.

Answers

  • Options
    Answer ✓

    Hi @toddfielder. First, yes, we are all frustrated at out of date tutorials. You are not alone there at all. That said, It would be a full time job keeping the tutorials up to date with as fast as the HoloToolkit is changing. The input stuff you are working with is literally brand new within the last two weeks. It's also really, really awesome.

    It sounds like you are halfway there as it is. The remaining part you need to do is create a new script that will be attached to your object, and have it implement the appropriate interface documented in the input module readme. In your particular case, I believe you are looking for IInputClickHandler. That should handle the RaiseSourceClickedEvent().

    If you need further info, please let me know. Also. take a look at the readme under the input folder in the HTK, it's actually very well documented.

  • Options

    Thanks for your quick response...I realize both Unity and Hololens are changing quickly, tough to keep up...I'm new to both just struggling a bit more than I would like...I have used old code on other occasions as well because I just couldn't quite make it work with the new code...Probably a limitation on my part, but I'm definitely a learn by example guy, at least until I'm comfortable...

    Thanks again for your help...keep up the good work

  • Options
    edited December 2016

    Unfortuantely, I'm unable to get this working...2 more questions for you if you have time...
    1) Does it matter what object GestureInput.cs is attached to? It seems I can attach it to anything and an OnTappedEvent is fired...
    2) Do I need to use GazeManager.cs for this to work? I wasn't sure how to get that working either, so went with the older WorldCursor.cs code...

    Anyway, I think I'm just going to stick with the legacy code as I understand it and get it to work, but obviously, I'd like to learn this new API, just not quite sure how.

    thanks

    -Todd

  • Options
    changgyuchanggyu
    edited January 2017

    @toddfielder
    Air tapping is regcognized by GestureRecognizer. And you have to detect the focusedObject before sending a message.
    The focusedObject should have a script attached with OnSelect() implemented.

  • Options

    Hi, is there a C++ API for gestures?

  • Options

    Try using the example from TapToPlace.cs
    public virtual void OnInputClicked(InputClickedEventData eventData) { //do stuff when this GO is selected }

    and also include a
    using HoloToolkit.Unity.InputModule; public class MyClass : IInputClickHandler { //class stuff }

Sign In or Register to comment.