K
K
kos_dev2017-01-07 22:52:35
JavaScript
kos_dev, 2017-01-07 22:52:35

How to smoothly rotate a game object to face (Y-ku) to another?

Hello.
The bottom line is that when creating a "movement" for the character, it was necessary to turn him to face the object to which he runs.
How the "movement" goes:
After the click, a GameObject is created, to which the character runs, upon arrival, the GameObject is deleted.
The LookAt method is not suitable, because it turns the character to the object instantly.
I tried to do it through Quaternion.Lerp, Quaternion.RotateTowards, it does not react to it at all and does not rotate.
Who knows how to be, please help. Thank you very much in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2017-01-07
@kos_dev

Code with a lerp to the studio. If you need a turn depending on the distance traveled, then a lerp is what you need.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question