Rotating pinch slider shifts position of Thumb
Describe the bug
If you rotate the PinchSlider after launching the application, the Thumb shifts to the side.
To reproduce
- Open 'SliderExample' scene in MRTK Examples
- Rotate 'PinchSliderColorRed' on Scene Window
- Grabbing slider
- Thumb shifts to side
Expected behavior
Thumb does not move sideways when rotating.
Screenshots

Your setup (please complete the following information)
- Unity Version 2019.4.9f1
- MRTK Version v2.51
Target platform (please complete the following information)
- HoloLens 2
Verified, when the scene is rotated (you can do this by grabbing the title bar of the description panel), then when you pinch and move the slider thumb, it shows the shift.

I can also confirm this. The same behavior can be reproduced regardless of the axis used in the PinchSlider.cs script.
Current workaround: Only change the thumbRoot local Position.
- Calculate newSliderPos in the given UpdateUI() method via:
var newSliderPos = GetSliderAxis() * (sliderValue - .5f) * Vector3.Distance(SliderStartPosition, SliderEndPosition);
// ChosenSliderAxis * (sliderValue-.5) * Distance between start and end points (sliderThumbOffset should not be needed here.)
// -.5f needed to allow 0 be the center of the slider track.
newSliderPos += initialLocalThumbRootPosition; // adding the initial Position of the ThumbRoot to position it on the slider.
thumbRoot.transform.localPosition = newSliderPos;
- After storing the initial thumbRoot Position in start before initializing it via InitializeSliderThumb()
initialLocalThumbRootPosition = thumbRoot.transform.localPosition;
... not as pretty - but it allows to
- rotate the object or any of its parents
- change SliderAxis on runtime (need to re-run visuals, or slider position only updates correctly on first interaction.)
- while keeping the rest untouched.
Hope this helps anyone if their experiencing this issue before 2.6! 🚀