Physics rigidbody.velocity Stutter

I’m moving my player like this:

Update()
{
	if (_isAccelerating && _speed < FarmStableManager.SELECTED_CAMEL_DATA.topSpeed)
    {
        _speed += 6f * Time.deltaTime;
    }
    else
    {
        _speed -= 10f * Time.deltaTime;
		_speed = _speed <= 0f ? 0f : _speed;
    }
	
	_rigidbody.velocity = transform.forward * _speed;
}

And i have a couple of AIs moving with NavMeshAgent, the problem is everytime my player gets close to any of the AIs they start to stutter, i’ve already checked the proffiler everything seams fine, the FPS rate is ok, i don’t know why this is happening. Also, if i use transform.Translate this dosen’t happen.

I think your problem is here

if (_isAccelerating && _speed < FarmStableManager.SELECTED_CAMEL_DATA.topSpeed)

If you are accelerating but already too fast then your ELSE section will cause a deceleration, which could put you below maximum speed on the next update which will result in the speed incrementing again. Your speed then flip flops between being above and below the topSpeed

Try this instead

void Update()
 {
     if (_isAccelerating)
         _speed += 6f * Time.deltaTime;
     else
         _speed -= 10f * Time.deltaTime;

     _speed = Mathf.Clamp(_speed, 0, FarmStableManager.SELECTED_CAMEL_DATA.topSpeed);
     
     _rigidbody.velocity = transform.forward * _speed;
 }