Right now the built-in Ray Interactor is the only interactor that I’m using and it’s set to only be active when pointing at UI elements. I have some sliders in the world that I want to be controllable with the Ray Interactor and they work fine in that manner but the problem is, once a slider is selected, the analog stick will also move it left and right as the player is moving around the world, even when the Ray Interactor is no longer pointed at the UI. I don’t want anything affecting the slider except the Ray Interactor.
Update:
I got basically the behavior I wanted with this configuration. On UI hover enter, enable the sliders. On UI hover exit, disable the sliders.
The only minor issue is that it seems to fire for every layer of the UI so when you hover over a slider, it seems to fire for the canvas, the slider and the handle separately. This just means that the handle flickers a little and the SFX beep plays multiple times stacked on top of each other every time you hover over a slider/handle. The buttons function normally since they’re just the one UI layer.
Overall, much better behavior than before but could be a little cleaner.
Someone gave me a script on another website to try to stop the excess beeping but I was still getting the same behavior with that script. What’s even weirder is that I took the SFX call off the Ray Interactor and put it on the UI elements I wanted to beep (the buttons and just the slider object) but it was still the same behavior. Even though the slider text labels are completely separate objects, they still beeped on hover over. It’s like the canvas was inheriting the script from the child objects.
Anyway, I put the SFX call back on the Ray Interactor, then changed the layer for the slider text labels from “UI” to “Ignore Raycast” and that finally stopped the excess beeping. This behavior is pretty much perfect. I’ll mark this as solved.
So to be clear, you would like it so if you are pointing at any UI (or clicking UI with the trigger), locomotion would be disabled so the player wouldn’t move around and cause the slider to move as the ray is moved along with the player? We currently have similar functionality where we disable locomotion when pointing at scrollable UI in the ControllerInputActionManager
(ActionBasedControllerManager
in XRI 2.x), so one solution is for us to add the ability to do that same thing when pointing even at non-scrollable UI.
I didn’t want locomotion disabled. I originally wanted analog stick control over the selected UI element disabled.
(Former) Current Behavior:
Player walks up to menu in the game world.
Player interacts with UI sliders.
Player walks away.
Analog stick used for locomotion continues to change the UI slider value because it remains “selected” even after player walks away.
Desired Behavior:
Player walks up to menu in the game world.
Player interacts with UI sliders.
Player walks away.
UI sliders hold their values either because they are automatically deselected or because analog control over sliders is permanently disabled.
The configuration in post #2 deactivates the sliders on UIHoverExit so it achieves the desired behavior. I’m still new so I don’t know if there’s a more efficient way to do it but it works.