Search code examples
user-interfaceunity-game-engineslideruislidervirtual-reality

Unity slider interaction with controller


So I have a laser pointer attached to my controller, shooting rays and triggering events whenever I press the tigger. Tho it still has one or two buggs (Unity VR Controller UI Interaction), I have a more general question.

The UI needs some kind of slider. And I can't figure out how to make my pointer collide with the slider and behave in a slider-ish way. When I press my button, it currently ends up setting the slider to zero and not letting me drag it. Thankful for any tipps on how to make them actually slide, since my ridgidbody-cube doesnt move and doesn't allow movement! Unitys documentation on e.g. the beginDragHandler isn't really helpful...

Cheers, Flo


Solution

  • If your enter/exit events already works, juste check the x (or the axis corresponding on your slider) of your "laser" every frame or so, and increase/decrease the value of the slider based on the delta between two check.

    Hope it is clear, it should not be hard if you already have your events sets up !