SpatialUnderstandingExample needs to have UI fixed
See original GitHub issueTrying out the SpatialUnderstandingExample I noticed that the buttons kept flickering when you keep your cursor on them. Turns out the GazeManager keeps cycling through the different layers of the UI elements and fires GazeManager_FocusedChanged
of the InputManager constantly.
How to reproduce:
- Open SpatialUnderstandingExample scene in the Unity-Editor.
- Scan the room till you can complete the scan process to get the UI to pop up.
- Place your cursor on any layered UI elements (tab buttons, regular buttons).
- GazeManager will now keep firing focus changed event with the different elements in layers under the cursor.
For exampling just printing the name of the HitObject
element when placing the cursor on one of the buttons and leaving it there for a few seconds:
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Spatial mapping - Mixed Reality
Spatial mapping provides a detailed representation of real-world surfaces in the environment around the HoloLens.
Read more >#Hololens – Spatial Understanding vs Spatial Mapping, and a ...
Spatial Mapping is the asset that we use by default and is the one which allows us to have basic control over the...
Read more >Designing Spatial UI: Part 6. Understanding 3D Coordinates ...
To understand the position in three-dimensional space, we need three values expressed as x, y, and z-axes of the coordinate frame.
Read more >Spatial Understanding Tutorial | The Open Augmented ...
In this tutorial I will give you an overview of spatial understanding, demonstrate the use of solvers and show how we can use...
Read more >Spatial layout | Apple Developer Documentation
Spatial layout techniques help you take advantage of the infinite canvas of Apple Vision Pro and present your content in engaging, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I did some more testing and found more issues. It’s not just the regression that causes the focus change firing, it only makes it slightly worse. Here doing the same reproduction steps with a commit just before the merge:
The issue is that with this UI setup, raycasts simply don’t work. I think the general idea behind the current design is wrong or has to be used differently. The main issue is that the UI all exists in the same plane. The canvas and all it’s child ui elements have the same z-coordinate so they all have the same distance to the camera. However because of floating point variations in the raycast calculations it will alwas choose a random one that is the “clostest”.
The 3D raycast will choose a random ui-element of the canvas layer which will then be compared to a different random ui-element from the ui raycast. The regression only adds a few more randomly selected ui-elements for the second one which makes it worse.
A solution would be to add a small z-position to every single ui element so that the raycasts can actually detect the depth that they have. Like this the current system could be kept but every ui would have to be set up like this.
My second idea would be to have different layers for the canvas and its ui-elements. Only the canvas itself would be hit by the 3D raycast but not any of the ui-elements. After detecting a canvas got hit we then can do a ui raycast for the other layer where we determine which is the top element by their depth in the canvas.
Thanks @Zod- , and thanks @kmikkel … going with ease on this one, the z-value offset seems to have worked for the most part, still very subtle flicker when button or input field is gazed at, but notably better both visually and functionally. Was the quick hack I needed to meet the deadline, thanks all!