M
M
MadDog13372021-01-17 15:46:14
Unity
MadDog1337, 2021-01-17 15:46:14

How to set the movement of the character with swipes?

600430912b03e958138295.pngThat is, the character is moving, and I let's swipe down, I ask him the other side of the movement as in screenshot number 2.
600430ede1865909160156.png

I wrote the code, but it doesn't work the way I need it, but I didn't find something on the Internet.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DanielMcRon, 2021-01-17
@DanielMcRon

It's even very simple. Create a Vector3 swipeDirection variable. And when swiping, for example, to the left, you write swipeDirection = the vector along which the character will fly exactly to the left.
After that, this vector multiplied by the speed will be used in each frame. On the next swipe, this variable is simply overwritten. Nothing complicated

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question