- Home /
Smooth Mobile Scroll
Hey there!
I'm trying to achieve that I can scroll a texture (inside a material) smoothly on mobile (by touch). Something like this: https://www.youtube.com/watch?v=IyeDbdAQCio
Right now I move the texture with the position.x of my finger, but when I release my finger, of course, nothing happens. What I want to achieve, as in the video, have a smooth scroll.
I have been looking through Google and the Unity forums but I haven't come across a solution and hoped if someone could steer me in the right direction!
Could you possibly use a ScrollRect using Unity's UI system? That offers smooth scrolling, and you can even set the deceleration rate.
If that does not work for you, you could try using UnityEngine.EventSystems and inheriting from IDragHandler and IEndDragHandler. Then, you make the texture follow you finger's x or y and average out the speed you finger is moving in OnDrag(), and make the texture begin decelerating in OnEndDrag().
Your answer
Follow this Question
Related Questions
Applying UV to plane mesh is pixel imperfect. 0 Answers
[ problem ] transparent shader !!! 1 Answer
Apply PNG as texture to 3d object 0 Answers
How to switch the texture being used by the material of the mesh renderer 1 Answer
Different prefabs with same mesh but different textures(materials). 1 Answer