How to rotate player controller properly

i made a joystick that triggers an animation while controlling the player to move in that direction. so i searched on your youtube and they used quaternion to solve it. it did solve my problem but it started making the screen shake anytime i move. what can i do???

heres the code

void joystickControls()
{
	if (joy.Horizontal != 0f || joy.Vertical != 0f)
	{
		anim.GetComponent<Animator>().Play("WalkForward");
		transform.rotation = Quaternion.LookRotation(rb.velocity);

	}
	if (joy.Horizontal == 0f && joy.Vertical == 0f)
	{        
		anim.GetComponent<Animator>().Play("Idle");
	}
}

Try

[SerializeField] Animator _animator = null;
[SerializeField] Rigidbody _rigidbody = null;
void JoystickControls()
{
	Vector3 velocity = _rigidbody.velocity;
	Vector3 velocityXZ = new Vector3( velocity.x , 0 , velocity.z );//ignores Y (falling, jumping)
	float speedXZ = velocityXZ.magnitude;

	if( joy.Horizontal!=0f || joy.Vertical!=0f )
	{
		_animator.Play("WalkForward");
		if( speedXZ>0.01f )
		{
			transform.rotation = Quaternion.LookRotation( velocityXZ , Vector3.up );
		}
	}
	else
	{
		_animator.Play("Idle");
	}
}