Matthew Scicluna
Matthew Scicluna

Reputation: 108

Unity Player Rotation Issue

I am creating a game using Unity where the player has to use the wasd to move the player 1 tile at a time (3D), I would like to make the player rotate smoothly with movement accordingly when one of the keys is pressed as seen in the image below. I have tried countless approaches but still can't seem to make it work would appreciate it if you can help me out.

enter image description here

Upvotes: 0

Views: 36

Answers (1)

vasmos
vasmos

Reputation: 2586

Lerping is good for moving smoothly from one position to another you can refactor code from here and call

void update() {
if (Input.GetKey("w")) {
//begin lerp up
}
//program same for asd 
}

https://docs.unity3d.com/ScriptReference/Vector3.Lerp.html

Upvotes: 1

Related Questions