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 use the DirectionIndicator script?

Is there any sample available demonstrating the usage of the DirectionIndicator script?
(from the github toolkit)

How to make it running properly with dynamically created object?

Thanks.

Answers

  • Options

    @Jerome after reading through the comments in DirectionIndicator.cs and experimenting with my current project I found that in order to use the DirectionIndicator script from the HoloToolkit you need to:

    Assuming you have an existing unity project that already has cursor support and some target game object of interest:

    • in your hierarchy select the target game object that you want to direct the user to
    • in the inspector for that game object add component "Direction Indicator"
    • in the inspector scroll down to the Direction Indicator and you will see two properties that you must set:
      - Cursor
      - Direction Indicator Object

    For Cursor, drag the cursor object from your hierarchy into the Cursor property box

    For Direction Indicator Object you need some other model to act as your pointer. I didn't see a sample object in the HoloToolkit that seemed appropriate, so for kicks I created a 3D Object > Capsule in my hierarchy, adjusted its scale to be appropriate in comparison to my target object, then dragged it out of my hierarchy into my Assets > Models folder in the Project explorer. By removing it from the hierarchy, it won't appear as part of the scene to start with.

    Then I again selected the target object in the hierarchy, scrolled down to the Direction Indicator section and then dragged my capsule from my assets folder into the "Direction Indicator Object" property box.

    The Direction Indicator defaults out to a Blue color and a few other settings that seemed fine as a starting point.

    Basically that seemed to be enough that when I built and deployed the app a dynamically appearing blue capsule appeared about a foot from my gaze cursor pointing in the direction of my target object. As I moved my gaze, the capsule adjusted accordingly.

    For production it would make sense to use some other simple model as a pointer instead of a capsule, but for purposes of testing it worked.

    HTH

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options
    JeromeJerome ✭✭

    My problem is when i instatiate the targeted object dynamically in the scene. And also I try to use a sprite instead of a 3d object, and the system did not rotate it.
    If we can have a sample like the one used in roboraid, it will be cool

  • Options

    @Jerome what do you mean by "instatiate the targeted object dynamically"?
    The DirectionIndicator script takes care of creating an instance of the targeted object as long as you assign it from your assets at design time.

    I don't know if 2d sprites are supported with this script or not, but 3D objects are (as I have detailed above), so you could certainly create a flat 3D object that looks like your sprite.

    Besides all the awesome game play and cool graphics I found my test created a similar experience to the Robo Raid one or at least could be tweaked to be very similar. Have you tried what I described and did it work for you?

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Options
    JeromeJerome ✭✭

    Hi, yes, using the script on an object in the scene worked fine out of the box.
    for the sprite I found my problem, and now I'm able to use it.
    and finally, to be able to use the DirectionIndicator with a prefab object (my code instantiate the prefab on the fly), I changed the DirectionIndicator script to search for the cursor in the scene by its name.
    So now I can create my object and the DirectionIndicator is working correctly... well... I have to solve an rotation issue... the sprite appear to point always to the same direction.

  • Options

    @HoloSheep Hello,
    I'm very new in unity hololens, I have tried what you said but doesn't work. How to add Directional indicator in a new project? There's no Directional indicator "asset" and "script" in holotoolkit 5.5. And if I import this from the file of tutorial hologram210, I cannot get the result like in the tutorial.
    Thanks a lot.

Sign In or Register to comment.