Pinch slider
A pinch slider component allows the user to continuously change a value by moving the slider thumb along a track.
Creating a pinch slider from scratch
Create a new actor blueprint with a
UxtPinchSliderComponent
as the root component of the actor.Add a Sphere static mesh to the actor and call it Thumb. Set its scale to 0.025.
Select the UxtPinchSliderComponent and set the Visuals property to reference the sphere mesh.
Add a Cylinder static mesh to the actor and call it Track. Set its scale to (0.01, 0.01, 0.5) and its X rotation to 90 degrees.
If the slider is configured correctly it will look like this:
Events
Although the slider created above is behaving correctly, it's not doing anything useful. The UxtPinchSliderComponent
has a number of events that can be used to respond to slider input:
- OnUpdateState: Event raised when slider changes state.
- OnBeginFocus: Event raised when a pointer starts focusing the slider.
- OnUpdateFocus: Event raised when a focusing pointer updates.
- OnEndFocus: Event raised when a pointer stops focusing the slider.
- OnBeginGrab: Event raised when slider is grabbed.
- OnUpdateValue: Event raised when slider's value changes.
- OnEndGrab: Event raised when slider is released.
- OnEnable: Event raised when slider is enabled.
- OnDisable: Event raised when slider is disabled.
HoloLens 2 Pinch Slider
UXTools provides a ready to use HoloLens 2 style pinch slider called the UxtPinchSliderActor
.
This slider can be configured and extended using Blueprints or C++. There is an example of this in BP_HandMenuSlider
that can be found in the hand menu example scene.