microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

GazeManager sets the normal incorrectly when the Raycast does not hit a hologram #45

Closed david-c-kline closed 8 years ago

david-c-kline commented 8 years ago

This is noticeable if you create a "CursorOffHolograms" model that does not have a "back" side to render. What is happening is the normal when no collision is detected is set in the direction of the user's gaze, this turns the model's face away from the user. The solution is to set the normal in the opposite direction of the user's gaze (back toward the user).

NeerajW commented 8 years ago

Does this seem like an app/asset specific fix or you think this will work with all assets?

david-c-kline commented 8 years ago

I do not see why this would not work with all assets. In fact, I believe this proposal was the initial intent of the code. ☺

David

From: Neeraj Wadhwa [mailto:notifications@github.com] Sent: Wednesday, May 18, 2016 9:23 AM To: Microsoft/HoloToolkit-Unity HoloToolkit-Unity@noreply.github.com Cc: David Kline (XBOX) David.Kline@microsoft.com; Assign assign@noreply.github.com Subject: Re: [Microsoft/HoloToolkit-Unity] GazeManager sets the normal incorrectly when the Raycast does not hit a hologram (#45)

Does this seem like an app/asset specific fix or you think this will work with all assets?

— You are receiving this because you were assigned. Reply to this email directly or view it on GitHubhttps://github.com/Microsoft/HoloToolkit-Unity/issues/45#issuecomment-220080965

NeerajW commented 8 years ago

Please test that out before the pull. Thanks!

NeerajW commented 8 years ago

@jochao I believe your recent check in https://github.com/Microsoft/HoloToolkit-Unity/pull/59 fixed this issue? If so, then please feel free to close this issue.

jochao commented 8 years ago

Yes, in checkin #59, GazeManager was updated with reversing the normal direction the asset points when the raycast doesn't hit a hologram.

                  // If the raycast does not hit a hologram, default the position to last hit distance in front of the user,
                 // and the normal to face the user.
                 Position = gazeOrigin + (gazeDirection * lastHitDistance);
                Normal = -gazeDirection;
                 focusedObject = null;
             }