B
B
babydick_danilko2021-05-20 22:16:58
C++ / C#
babydick_danilko, 2021-05-20 22:16:58

How to track an infinite circular swipe in Unity?

How is it possible to realize, as it were, the spinning, for example, of a drum, so that the drum can be spun in endless circular motions without releasing it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly Kachan, 2021-05-21
@MANAB

Just like regular touch. If the drum spins, then it has some kind of mass/inertia. You need to RayCast to the point where the finger was and where it is now, calculate the motion vector and project it onto the tangent to the normal (which is from the center to the point of the current touch). Multiplying by some coefficient that characterizes the moment of inertia of the drum and comparing it with what speed the drum already has or whether we increase the speed or not (if the drum is already spinning faster than a finger)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question