P
P
Pragma Games2021-12-20 17:24:46
Unity
Pragma Games, 2021-12-20 17:24:46

How to solve the problem with character movement?

Hello. Quite a hackneyed question, but still. There is a player who can move. The dog always follows him. When the dog reaches the point (the point is a transform that moves after the player), it starts to spin, I understand why this is happening, I tried to solve this problem with a conditionally allowable distance at which the dog can stop ( {Vector2.Distance(dog, point ) < tolerance}). But because of this, the dog seems to walk in jerks, even if the player walks continuously forward. The selection of a conditionally permissible distance did not give any special results. Maybe there is some universal way to solve this problem?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
LittleBob, 2021-12-20
@LittleBob

Is it possible to make the dog move through Mathf.Lerp or MoveTowards?

R
reLse, 2021-12-21
@reLse

Maybe it’s better to do a dog through NavMesh, and if you stop moving when the distance does not allow, then what’s the problem?)

N
Nekit Medvedev, 2021-12-21
@NIKROTOS

Why would a dog follow a player all the time? Make 2 triggers, one near the player, if the dog hits him, the movement script is cut out, the second with a certain radius, if the dog leaves him, the script turns on.
Or use for this not triggers, but the distance to the player (The owner is far? Go after him. The owner is close? Sit, look, so as not to go far).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question