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.

Holograms-210-Gaze cursor normal not right

Hi, I am following the Hololens Academy Holograms-210-Gaze tutorial. I believe my code is the same as the code on the website. However, when I ran my App, my cursor normal is always perpendicular to the hit object normal so the cursor is not facing me but facing up. I then ran the "Complete" project in the downloaded file. The cursor was facing me, which was correct. What could I do wrong?

Answers

  • @Fireman
    I apologize for being a novice but how did you get pass chapter 2? How do I edit the GazeManager.cs file, and edit it to perform the following tasks:
    1.Perform a physics raycast,
    2.Store the position and normal of the raycast intersection,
    3.If the raycast did not hit anything, set the position and normal to defaults.

    gokk.PNG 145.2K
  • @evanjames,
    To update your code to the completed version, simply click on the 'show' option next to the name of the script in the online Academy chapter (in this case, 'GazeManager.cs'). This will expand the coding solution. You can then triple-click within the code block to select all of the code and copy it. Then, go back to Visual Studio, delete all of the old code in the relevant script file, and paste in the code that you copied from the Academy site. Be sure to select 'Save All' in Visual Studio so that your code will be properly saved for both VS and Unity.

  • @Fireman,
    It sounds like CursorManager needs to be updated. That's the script which will rotate the cursor to match the normal of whatever hologram was hit by the GazeManager.

  • @ahiller Thanks. DO you know the code on that web page is wrong but the code inside the download is correct?

  • ahillierahillier mod
    edited May 2016

    Hi @Fireman,
    What part of the code is incorrect on the web page? I just compared CursorManager.cs from the Academy page with the completed code for that project and did not find anything different between the two scripts (except for some comments). Let us know where you found an issue and we can try to fix it.
    Thanks,
    ~Angela

  • @Fireman said:
    @ahiller Thanks. DO you know the code on that web page is wrong but the code inside the download is correct?

    This very true

  • I applied everything in the tutorial but I am not sure the Gaze is working correctly. is the astroman supposed move when you move?

  • @ahiller the "Complete" set in the download package was correct. I verified that too. But when I started with a empty project and follow the tutorial step by step and edited the code myself, the cursor normal is not correct. I double checked my code is the same as the one on the web page.

  • @ahillier I am on Chapter 2d of Holograms 210. I used the same code as per the tutorial page, but I couldn't see any highlighting effect, as expected from the Interactible and InteractibleManager classes. Any ideas?
  • OK, so I just completed chapters 1-3 of the course using the online instructions. I found a few typos (the biggest one being that the cursor is actually located in the HoloToolkit\Input\Prefabs folder), but all of the code seems to be correct.

    @Fireman, at the end of chapter 2, the cursor behaved as expected for me. Probably the best visual for how the cursor normal changes is by targeting the AstroMan's helmet and walking around it. The purple cursor should sit flush to the surface of the helmet. The other surfaces are harder to see this with, because the AstroMan is animated and whenever the arms/legs move, the cursor has the potential of going inside of the mesh instead of sitting on top of it. When you are not looking at the AstroMan, the cursor should change to a fuzzy point light, and we do nothing with the normal when the cursor is in this form.

    @Main, double-check that you added the 'Interactible.cs' component to the AstroMan in your Hierarchy, and 'InteractibleManager.cs' to your Managers object, and that you updated both scripts with the code at the end of chapter 2. These two scripts are responsible for setting the specular highlight when gaze enters/leaves a region of the AstroMan. The AstroMan will appear darker in this deploy, and only the region that you are looking at (where the purple cursor appears) should be highlighted. Be sure to press the 'Save All' button in Visual Studio before you build from Unity.

    One thing that can mess up deploys is if you have not closed the previously running version of the application before deploying again to the HoloLens. The fastest way to close the application is through the windows device portal. You can use the 'Apps' page to close out the 'ModelExplorer' application by finding it in the 'Running apps' section and then selecting the 'X' to the left of the application name. If you don't close the app between deploys, then there is the potential that the old application will continue to run, so you won't see any of your updates.

    I hope this helps, let me know if you encounter any more issues.
    Thanks,
    ~Angela

  • @ahillier said:
    OK, so I just completed chapters 1-3 of the course using the online instructions. I found a few typos (the biggest one being that the cursor is actually located in the HoloToolkit\Input\Prefabs folder), but all of the code seems to be correct.

    @Fireman, at the end of chapter 2, the cursor behaved as expected for me. Probably the best visual for how the cursor normal changes is by targeting the AstroMan's helmet and walking around it. The purple cursor should sit flush to the surface of the helmet. The other surfaces are harder to see this with, because the AstroMan is animated and whenever the arms/legs move, the cursor has the potential of going inside of the mesh instead of sitting on top of it. When you are not looking at the AstroMan, the cursor should change to a fuzzy point light, and we do nothing with the normal when the cursor is in this form.

    @Main, double-check that you added the 'Interactible.cs' component to the AstroMan in your Hierarchy, and 'InteractibleManager.cs' to your Managers object, and that you updated both scripts with the code at the end of chapter 2. These two scripts are responsible for setting the specular highlight when gaze enters/leaves a region of the AstroMan. The AstroMan will appear darker in this deploy, and only the region that you are looking at (where the purple cursor appears) should be highlighted. Be sure to press the 'Save All' button in Visual Studio before you build from Unity.

    One thing that can mess up deploys is if you have not closed the previously running version of the application before deploying again to the HoloLens. The fastest way to close the application is through the windows device portal. You can use the 'Apps' page to close out the 'ModelExplorer' application by finding it in the 'Running apps' section and then selecting the 'X' to the left of the application name. If you don't close the app between deploys, then there is the potential that the old application will continue to run, so you won't see any of your updates.

    I hope this helps, let me know if you encounter any more issues.
    Thanks,
    ~Angela

    Thank you Angela. I realized just now that I was getting an error in Unity: MissingComponentException: There is no 'Renderer' attached to the "AstroMan" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "AstroMan". Or your script needs to check if the component is attached before using it.
    Interactible.Start () (at Assets/Scripts/Interactible.cs:17)

    However, I don't see "Renderer" being part of the tutorial instructions. Therefore, I guess this might be the problem.

  • Well I have just downloaded the code from GitHub HolographicAcademy
    Download HolographicAcademy-Holograms-210-Gaze from the list.
    Unpack to a short directory path
    Navigate to .....\Holo-210-Gaze\Completed\ModelExplorer\Assets\Scenes
    and double click on ModelExplorer.unity icon
    Unity starts, and this works on build 12 to build 18,
    When Unity Windows opens navigate to Projects -> Assets ->Scenes
    Double Click on ModelExplorer.unity icon.
    This selects the correct scene to Build
    Using instructions from tutorial
    Build the project
    •Save the new scene: File > Save Scene As.
    •Click New Folder and name the folder Scenes.
    •Name the file "ModelExplorer" and save it in the Scenes folder.
    •In Unity select File > Build Settings.
    •Click Add Open Scenes to add the scene.
    •Select Windows Store in the Platform list and click Switch Platform.
    •Set SDK to Universal 10 and Build Type to D3D.
    •Check Unity C# Projects.
    •Click Build.
    •Create a New Folder named "App".
    •Single click the App Folder.
    •Press Select Folder.
    •When Unity is done, a File Explorer window will appear.
    •Open the App Folder.
    •Open the ModelExplorer Visual Studio Solution.
    •In Visual Studio, right click on Package.appxmanifest in the Solution Explorer and select View Code
    •Find the line specifying TargetDeviceFamily and change Name="Windows.Universal" to Name="Windows.Holographic".
    •Save the Package.appxmanifest.
    •Using the top toolbar in Visual Studio, change the target from Debug to Release and from ARM to x86.
    DONT Worry about errors when loading FIRST time, only on final rebuild, Visual Studio DOES NOT clear error windows
    Rebuild "Release,x86,HoloLens Emulator"
    Then build "Release,x86,Device" for the real HoloLens device
    Deploy solution to device or emulator
    Debug -> Start Without debugging
    To debug refer to debugging tutorial written for the next exercise :)

    tutorial-debugging-with-holograms-211-with-update-code-library

  • @Main said:
    Thank you Angela. I realized just now that I was getting an error in Unity: MissingComponentException: There is no 'Renderer' attached to the "AstroMan" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "AstroMan". Or your script needs to check if the component is attached before using it.
    Interactible.Start () (at Assets/Scripts/Interactible.cs:17)

    However, I don't see "Renderer" being part of the tutorial instructions. Therefore, I guess this might be the problem.

    Just remove the Interactible.cs script from root AstroMan object (if you added it like me) and it should compile and run again (this script is already attached to every individual parts of AstroMan's body).

  • cyris90cyris90
    edited August 2016

    Ok, so after much messing around and frustration, in the instructions in the code it tells you to call the gazeStabilizer.UpdateHeadStability passing in the gazeOrigin and the Camera.main.transform.rotation and to set the gazeOrigin to gazeStabilizer.StableHeadPosition, however rotation is null and it causes your fitbox to be all jerky and your cursor not to show up, and it is not actually done in the code on the website. If remove these 2 lines or not put them in at all it will work just fine.

    Apparently I got ahead of myself, I had not got to the point of adding the gaze stabilizer yet, but tried to put the code in for it a bit early.

  • Has anybody recently followed the "Holograms 210" online tutorials?

    Are there still typos/mistakes/discrepancies between the webpage and the complete project code?

    The first script GazeManager.cs is incomplete; for examples the 3 lines starting with // 3.a: that I am supposed to complete by myself as a novice...

    Is there a webpage somewhere with the correct code? I don't want to download and unpack a complete zip; I just wanna follow the tutorial just as it is: comments that help me write the code myself, but by the looks of things, there are mistakes, there are incomplete bits, a couple of users on this forum do not get the behaviour that the astroman is supposed to exhibit, etc...

    Please let me know if there is an updated version or something somewhere that I can follow in the same manner as this tutorial.

  • I found this GitHub page which seems to contain the missing code. Hope it helps everyone on this thread.

Sign In or Register to comment.