Quantcast
Channel: Answers for "Player Rotation"
Viewing all articles
Browse latest Browse all 4

Answer by clfischer

$
0
0
In the Update function, where you select the new target, add the following line. transform.LookAt(hit.transform); This tells whatever your script is attached to to turn towards the object you just clicked. If the script isn't attached to the player but to something else, you should use `player.transform.LookAt(hit.transform)` instead. If you want the rotation to be smooth it'll take a few more lines of code using [Lerp()][1]. [1]: http://unity3d.com/support/documentation/ScriptReference/Quaternion.Lerp.html

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images