R
R
Roman Tuzov2020-03-20 19:01:03
css
Roman Tuzov, 2020-03-20 19:01:03

How to make an object move with your finger?

How to make an object move smoothly behind the finger only along the y axis? I watched a lot on the Internet, tried a lot of codes with alteration to suit my needs. But everything does not work out because I am a beginner and I am learning how to do it. With a computer, it’s clear how, but with the phone there are always difficulties. You need to somehow make the user hold his finger on the screen and move it up / down, moving the object accordingly.
So far, this is implemented like this only through the keyboard

void FixedUpdate () {
    obj.transform.Translate(Vector2.left * speed * Time.deltaTime);
    float yPoz = Input.GetAxis("Vertical");
    Vector2 direction = new Vector2(-1,yPoz);
    obj.transform.Translate(direction * speed * Time.deltaTime);
  }

Answer the question

In order to leave comments, you need to log in

4 answer(s)
Y
y0u, 2019-08-22
@y0u

https://toster.ru/search/questions?q=%D0%9A%D0%B0%...

N
Nikita Kolesnikov, 2019-08-22
@NikitOS_MV

Tyk

G
grinat, 2019-08-22
@grinat

1 Take a leaflet
2 Go to https://nominatim.openstreetmap.org/ and pull the city polygons
3 Convert it to geojson
4 Insert the data on the map, open the info popup when hovering over the polygon

D
DanielMcRon, 2020-03-20
@DanielMcRon

I don't think you've tried anything. You already ask 2 questions in an hour. Maybe you need to learn Unity along with C#. Ask stupid questions that take 3 times more time to explain to you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question