-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added check for valid uiRaycastResults and fixed pointer registration #1350
Added check for valid uiRaycastResults and fixed pointer registration #1350
Conversation
…sages in the console. The warning during play mode should be enough.
Will test this in the morning. |
This fixes the exception on my end. While we're in here, how do we feel about adding some Debug.Asserts in FocusManager, on lines 544 & 603 (or wherever else makes sense):
Might as well get ahead of incorrectly configured pointers. |
OnInputClicked(InputClickedEventData eventData) event is not called anymore perfectly after adding this changes. |
@sabingeo can you elaborate? |
After merging the changes to the latest commit it's no longer possible to select uGUI controls. OnIputClicked of the IInputClickHandler interface is no longer called. tested in the MotionControllerTest scene. eg : TapResponder.cs |
Which inputs are you using? Your Hands or the Motion controllers? |
Motion controllers |
Did you double check to make sure the |
in the MotionControllerTest.unity there is no canvas in the scene. There is blue cube attached with TapResponder.cs script.
and this part is never called after pressing the trigger. |
Are you also getting the failed assertions and nullable errors? |
sometimes I see the assertion failed and nullable errors. but not always |
@sabingeo try the latest |
So the failed assertions / errors I'm seeing are caused when GazeManager.UpdateGazeInfo() calls FocusManager.Instance.GetPointingExtent(this) to get its extent.
GetPointingExtent (IPointingSource pointingSource) attempts to track down the PointerData associated with this pointing source via TryGetPointerIndex(IPointingSource pointingSource) before passing it to this function:
Changing GetPointer to return a default doesn't seem to get ahead of this, because the pointers array isn't always populated before GetPointingExtent is called. Since IPointingSource has all the information you need to determine its extent, I don't understand the purpose of passing an IPointingSource to one function, then looking up its PointerData, then passing that to a private function, only to use the original IPointerData in the end. I could be missing something, but this seems like it could be cruft? We could make GetPointingExtent(IPointingSource pointingSource) a public function and eliminate the private function altogether:
This gives us a universal way for pointers to determine their own extent without causing errors. |
Agreed on all counts. In the middle of some updates, that I'm testing out atm. Essentially I removed the nullable types and replaced them with nicer fallbacks. |
Just working on one last small issue with the gaze getting unregistered when we should probably never do that. |
Updated internal pointer utilities. misc formatting.
@Railboy I think I fixed all the issues. Please let me know what you think. All tests passed, and built to HoloLens and PC with successful input testing.
|
Checking it out now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
} | ||
|
||
if ((pointers.Count == 0) && autoRegisterGazePointerIfNoPointersRegistered && GazeManager.IsInitialized) | ||
if (pointers.Count == 0 && autoRegisterGazePointerIfNoPointersRegistered && GazeManager.IsInitialized) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autoRegisterGazePointerIfNoPointersRegistered
what about:
autoRegisterGazeIfPointersEmpty
?
(matter of taste, feel free to ignore)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that field name is obnoxiously long haha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI in Unity 2017.0.2f3 I'm getting 3 assertion failures on startup in the InputManagerTest scene. But they're unrelated to the pointer issue:
Assertion failed: Main camera does not exist!
UnityEngine.XR.WSA.HolographicSettings:get_IsDisplayOpaque()
IsDisplayOpaque is being called by FadeScript and BoundaryManager. These failures don't happen in Unity MRTP 4 so I'm guessing it's an already-fixed XR bug on Unity's end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I'm trying to understand why you'd ever want to skip registering the gaze pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that was a hold over from only having active pointers registered. It looks like you've changed the way that works though, but I haven't had a chance to review all these recent changes.
@StephenHodgson I have checkout the latest source from your branch https://github.com/StephenHodgson/MixedRealityToolkit-Unity/tree/MRTK-uiRaycastHotfix Input events triggers perfectly fine now. But I see some other issues
I am using Unity 2017.2.0p1-MRTP4 (64-bit) and OS Windows 10 pro Insider preview. Version 1709 |
@sabingeo Thanks for taking a look. Are those issues related to this PR specifically? You may want to open a separate issue for these. I will not address them here unless they're directly related to this.
I'll look into this. |
… instead of searching though our index of pointers.
@Railboy I updated the PR with some of your suggestions about directly getting the pointer extents, etc. |
Great, the new function names / purposes seem a lot clearer to me. I'm not getting the camera translation errors @sabingeo is seeing so it may be a setup issue. The cursor distance issue is caused by using the terminus of the last RayStep in the cursor's pointer:
We can honor the maximum distance by using a static function to get a point along a set of RaySteps by distance. I can open up a new pull request to do this. |
Just open a PR on this branch I'm workin on if you got a fix. |
Since it's only tangentially related I'd rather roll it into #1364. It may take time to implement / test and I don't want to hold this merge up. |
Changes
InputManager
.OnValidate
checking theUIRaycastCamera
so there's not a warning every time we recompile. (For some reason during deserailization when the script is loading, theuiRaycastCamera
is null, even though the serialized value is valid.)