Controller Move/Rotate more smoothly

Hello!

Im using that script

direction = Vector3(input.GetAxis, 0, input.GetAxis);
direction *= .1f; // apply speed

// move the character in this direction
controller.Move(direction);
	
// Change the forward direction of the player into the direction he is running
controller.transform.forward = direction;
		
defending = false;
player.animation.CrossFade("Run");

But when i turn the joystick axis from right to the left the character “jumps”.

Im trying to use Quaternion Lerp or Slerp but i dont understand Quaternion code well.

Thank you in advance.

I believe what’s happening is, the direction of your controller is being set to the Y axis.
So, when you’re moving from left to right, which should change the X value, it’s changing the Y value instead.

The problem lies in the statement
controller.tranform.forward = direction;

Try,

controller.transform.forward = direction.x or direction.z