- Home /
How can i implement a scroll speed for a scroll view/rect so that my content travels slower when I drag?
Very simply, I need the content of my scroll view to scroll slower than my drag as if there is resistance to the drag. I'm thinking a scroll speed variable that could actually manipulate the content to be slower or dampen or something of the like. If anyone has any advice it would be greatly appreciated.
Answer by qsp18 · Dec 08, 2020 at 05:26 PM
You can code a scrollbar on your own: Make the UI-Element follow your Mouse is something like this: https://answers.unity.com/questions/849117/46-ui-image-follow-mouse-position.html
But I would not just let the UIElement always teleport to the mouse. I would save the offset (UI-Element to mouse) and then move the UI always to mouse plus offset
Ofc you need to play with masks...
Your needed Changes: Make a variable x (position), where the mousePosition plus offset is. Then you calculate the vector between x and the UI-Element. Then you move your UI Element each update x.normaized multiplied Time.deltaTime multiplied ScrollSpeed
Your answer
Follow this Question
Related Questions
Nested Scroll Views: How can I pass drag control from an inner scroll view to its outer scroll view? 2 Answers
Focus on Selected Item in Vertical Scrollview 0 Answers
How to check if child item is visible in ScrollView? 1 Answer
I am still able to scroll even though scroll type is clamped? 0 Answers
Scroll rect snaps everytime with drag 0 Answers