Domanda

I want to develop a "scrollview" in Unity.

Basically I have a Parent Game Object on the screen with many items inside it. The Parent Game Object is big enough so it goes outside the screen.

I developed a scrolling script so when the user drags the parent object, I move it and it looks like scrolling.

I did this by implementing the OnMouseDrag event.

How can I calculate the inertia and apply it so when the user drags it fast, it continues to move?

È stato utile?

Soluzione

What you want, the effect that you want, is called kinetic scroll/scrolling/panning .

Here is an answer with a generic algorithm in it, I'm sure that with this keyword in mind you will probably find a ton more of examples.

Next time watch out for the tags, your first set of tags was incorrect, other frameworks have the same unity name .

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top