N
N
Nikita Mamchenko2020-12-27 16:42:13
Unity
Nikita Mamchenko, 2020-12-27 16:42:13

How to make a record counter by distance in Unity?

I'm making a casual game, but I can't figure out how to make a record that reads the distance traveled. Well, for example, a player flew 2 meters up and the record began to equal two (2). Approximately (or the same) as in the game Hill Climb Racing.

Unity C#

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-12-28
@SLiverRU

The GameObject has a transform field, which has a position - you take the necessary component there: x/y/z.
You can easily calculate the path by the coordinate

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question