hey I am quite new to coding and I'm trying to right a simple player movement script using rigidbody. I have been able to make my player move and turn to face its movement direction I just cannot figure out how to make it do it smoothly . I have made a float for turnspeed/smoothing but cannot figure out how to implement it into my code. sorry if my codes messy or wrong I am very new to this and would love some constructive advice cheers .
my code :
public float smoothing = .1f;
public void Update()
{
movement = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical")).normalized;
private void FixedUpdate()
{
moveCharacter(movement);
private void moveCharacter(Vector3 direction)
{
// player look direction
Vector3 lookDirection = movement + gameObject.transform.position;
gameObject.transform.LookAt(lookDirection);
// movement
rigidBodyComponant.MovePosition(transform.position + (direction * speed * Time.deltaTime));
}