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
Disable pointers from code #5920
Disable pointers from code #5920
Conversation
…e buttons to show up
* rename to TurnPointersOnOff * move TurnPointersOnOff to namespace
…954_enabledisablepointers
Still TO DO in this PR:
|
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.
Great stuff! Super excited to finally give this power to developers. Most comments are minor nits/suggestions.
The only thing that scares me is the actual enum. Now realizing that On actually means AlwaysOn. I am worried that developers will set the values On/Off and not Default/Off. Like oh, I want this pointer to be on...and do it's default thing.
...MixedRealityToolkit.Examples/Demos/Input/Scenes/TurnPointerOnOffExample/TurnPointersOnOff.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Pointers/DefaultPointerMediator.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.Services/InputSystem/FocusProvider.cs
Outdated
Show resolved
Hide resolved
Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/Pointers/PokePointer.cs
Show resolved
Hide resolved
Assets/MixedRealityToolkit.SDK/Features/Utilities/PointerUtils.cs
Outdated
Show resolved
Hide resolved
Documentation/Architecture/InputSystem/ControllersPointersAndFocus.md
Outdated
Show resolved
Hide resolved
Documentation/Architecture/InputSystem/ControllersPointersAndFocus.md
Outdated
Show resolved
Hide resolved
Documentation/Architecture/InputSystem/ControllersPointersAndFocus.md
Outdated
Show resolved
Hide resolved
...les/Demos/Input/Scenes/TurnPointerOnOffExample/TunrPointersOnOff Configuration Profile.asset
Outdated
Show resolved
Hide resolved
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 2 pipeline(s). |
Troy says changes are good but isn't available to approve, so dismissing review
Is it the expected behavior to not receive any |
If you turn off the HandRayPointer and you may have to enable an alternative pointer. For example:
|
With the GazePointer enabled and the HandRayPointer disabled, I still get the same behavior. No callbacks to the IMixedRealityPointerHandler functions. For example, the log is never printed (with the below type of code). With the class implementing IMixedRealityPointerHandler interface. But commenting out the SetHandRayPointerBehavior works fine.
Tested on the sample scene (DisablePointersExample) too |
@pampas93 how are you activating the pointer down event with the gaze pointer? |
I'm implementing the |
@pampas93 no sorry I meant at runtime,are you just running in editor with gaze provided or on device? Do you look at the item with the script and say select with voice? |
I'm running this on the editor, with the hand visualized (input simulation). But I didn't get your second question. I'm not using any interactable script on the item to have it say select with voice. |
@pampas93 Ok I think I know what is going on. The reason why you are not getting a OnPointerDown event is because there is no pointer to fire it. You disable the hand ray pointer via PointerUtils.SetHandRayPointerBehavior() so that will no longer fire the events or be an active pointer. The GazePointer (GGVPointer) actually isn't active by default in editor. This is because by default the pointer is only created for "GGV Hand" input sources/controllers. I know this is a bit weird, but basically this type of "GGV Hand" will only show up on HL1. In editor and HL2, the type of hand created is "Articulated Hand" which only spawns the hand ray pointer and grab/poke pointers. I created a new issue #7182 to track making this more apparent in the API |
How to close TeleportPointer and ParabolicTeleportPointer ,Use code is not work
|
Overview
We have had many requests for how to disable the far interaction (line pointer, hand rays, etc) at runtime. For example, this stackoverflow question.
The default way to do this is not obvious, and requires creating a custom mediator. This change provides a way for people using the default
FocusProvider
andDefaultPointerMediator
to dynamically enable and disable pointers at runtime. Pointers can be enabled / disabled per handedness as well, allowing you to, for example, turn off hand rays for the right hand only.Developers turn pointers on and off by specifying the
PointerBehavior
for a pointer type. PointerBehavior is defined as follows:Here is an example of dynamically turning different pointers on / off:
Changes
PointerBehavior
to describe how pointer should behave: On, Off, Default (use MRTK Rules: gaze is off if hand rays on, hand rays off if they are near grabbable)FocusProvider
to set the pointer behavior for a pointer type and handednessPointerUtils
to set common pointer behaviorsOld way to turn pointers on off
See this stackoverflow question, it requires creating custom pointer mediator.
New way to turn pointers on / off
Verification