|
| 1 | +# Sliders |
| 2 | + |
| 3 | + |
| 4 | +Sliders are UI components that allow you to continuously change a value by moving a slider on a track. Currently the Pinch Slider can be moved by directly grabbing the slider, either directly or at a distance. Sliders work on AR and VR, using motion controllers, hands, or Gesture + Voice. |
| 5 | + |
| 6 | +## Sliders Example |
| 7 | +You can see an example usage of sliders in the file `Assets\MixedRealityToolkit.Examples\Demos\UX\Slider\Scenes\SliderExample.unity`. |
| 8 | + |
| 9 | +## How to use Sliders |
| 10 | +Drag and drop the **PinchSlider** prefab into the scene hierarchy. If you want to modify or create your own slider, remember to do the following: |
| 11 | + |
| 12 | +- Make sure your that your thumb object has a collider on it. In the PinchSlider prefab, the collider is on `SliderThumb/Button_AnimationContainer/Slider_Button` |
| 13 | +- Make sure that the object containing the collider also has a Near Interaction Grabbable component on it, if you want to be able to grab the slider near. |
| 14 | + |
| 15 | +We also recommend using the following hierarchy |
| 16 | + |
| 17 | +- PinchSlider - Contains the sliderComponent |
| 18 | + - SliderThumb - Contains the movable thumb |
| 19 | + - TrackVisuals - Containing the track and any other visuals |
| 20 | + - OtherVisuals - Containing any other visuals |
| 21 | + |
| 22 | +## Slider Events |
| 23 | +Sliders expose the following events: |
| 24 | +- OnValueUpdated - Called whenever the slider value changes |
| 25 | +- OnInteractionStarted - Called when the user grabs the slider |
| 26 | +- OnInteractionEnded - Called when the user releases the slider |
| 27 | +- OnHoverEntered - Called when the user's hand / controller hovers over the slider, using either near or far interaction. |
| 28 | +- OnHoverExited - Called when the user's hand / controller is no longer near the slider. |
| 29 | + |
| 30 | +## Configuring Slider Bound and Axis |
| 31 | +You can directly move the starting and end points of the slider by moving the handles in the Scene: |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +You can also specify the axis (in local space) of the slider via the _Slider Axis_ field |
| 36 | + |
| 37 | +If you cannot use the handles, you can instead specify the start and end points of the slider via the _Slider Start Position_ and _Slider End Position_ fields. |
| 38 | + |
| 39 | +> Note that the slider start and end position fields will get automatically projected to the slider axis. |
| 40 | +
|
| 41 | + |
0 commit comments