Search Unity

Overlay text message on HoloLens

Discussion in 'VR' started by NemesisEnforcer, Nov 24, 2016.

  1. NemesisEnforcer

    NemesisEnforcer

    Joined:
    Nov 2, 2016
    Posts:
    3
    Hi everyone,

    I'm new to Unity/HoloLens development & I've been trying to figure out a way to do the following:

    - A user will start my HoloLens app & see a text message prompting them to say a command word to proceed.

    - This text message must remain visible no matter what orientation the HoloLens set to, until the command word is given & then the text will be removed. For example if the wearer looks up, down left, right or tilts their head, the text should remain in their gaze & match the orientation.

    I'm ok with the voice command part of the development, however the text display is eluding me.

    Can anyone suggest or point me to a tutorial that would be appropriate for my above requirements. I have viewed all of the Microsoft Academy videos and none of them really matched my needs. Since I'm new to Unity/HoloLens I'm not sure if this requires a HoloLens, or a Unity game engine specific solution.

    Cheers & thanks for any help in advance.
     
  2. KarlosZafra

    KarlosZafra

    Joined:
    Sep 8, 2016
    Posts:
    18
    Have you checked the source code of the projects on Microsoft Academy? There you will find code examples, not obviously tailored to what you need, but there's a lot of scripts and prefabs that will help you.

    Have you tried attaching text to the camera? Do you know how to trigger events when user taps?
     
  3. NemesisEnforcer

    NemesisEnforcer

    Joined:
    Nov 2, 2016
    Posts:
    3
    Thanks for your reply.

    I took a deeper look into the Microsoft Academy code & found a TagAlong script feature that looks promising. Triggering events etc... I'm ok with. Just new to Unity so I'm not yet versed in the various setups to achieve certain effects. For example, when you say "attach text to the camera". How would I do that? I did a quick search but didn't see anything specific to what you mentioned. Just saw a bunch of stuff about "UI Text".
     
  4. BrandonFogerty

    BrandonFogerty

    Joined:
    Jan 29, 2016
    Posts:
    83
    Hi @NemesisEnforcer,

    You can make any game object a child of any other game object in your hierarchy by dragging and dropping the game object in your hierarchy onto another one. In your specific case, you can make a game object that contains a UI text component. You can then drag and drop that text game object onto the game object that contains your camera component. By doing this, the UI text game object will inherit the camera's transform. So if you move your head (I.E. the main camera), the text will automatically move along with your head because the UI text game object will be a child of the main camera. Please note that by doing this, the text will remain in perfect alignment with the camera. Some developers prefer to use a tag along behavior instead of using perfect alignment. The tag along component essentially allows another game object to ramp up/down its movement over time.

    For more information, please look at this video tutorial which covers parent/child transform relationships.
    https://unity3d.com/learn/tutorials...ials/hierarchy-and-parent-child-relationships
     
  5. NemesisEnforcer

    NemesisEnforcer

    Joined:
    Nov 2, 2016
    Posts:
    3
    Thank you Brandon for your explanation. I tried both methods and chose to use the tag-a-long method as it is much easier on the eye when viewed through the HoloLens. I find that the parenting method flickered too much when the head movements were rapid.

    Cheers.
     
    BrandonFogerty likes this.