- Home /
Question by
TheMemeGuy · May 14, 2018 at 12:07 AM ·
c#rotationmovementplayertransform.lookat
transform.lookat snaping direction
I am using transform.lookat to rotate my player into the movement direction, but when I go to press the other direction, instead of smoothly swiveling around the player just snaps into that direction, and when moving diagonally if I press another diagonal direction the player snaps really weirdly, here is the code I am currently using
float moveVertical = Input.GetAxis("Vertical"); float moveHorizontal = Input.GetAxis("Horizontal"); Vector3 Movement = new Vector3(moveHorizontal, 0.0f, moveVertical); transform.LookAt(Movement + transform.position); transform.Translate(Movement * walkSpeed * Time.deltaTime, Space.World);
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612162613im_/https://answers.unity.com/themes/thub/images/avi.jpg)