I have a player that can walk around in a 3d space. The Player is just a Capsule, with a regular Capuse Collider. The controls are simple so far.
var dir = Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
transform.Translate(dir*Time.deltaTime*10);
The problem is I need the player to look where its going. I’ve tried LookAt(dir)
, I’ve transform.Rotate(0, hor+dir,0)
but both get me really strange rotations. I’ve even tried
var rot = Quaternion.Euler(dir);
transform.rotation = Quaternion.Slerp(transform.rotation, rot, Time.deltaTime);
But that doesn’t do anything.
Can you help me?