This is a CharacterBody3D btw.
Should I use:
var moving = true if (ground_dir * speed).length() >= velocity.length() else false
speed = speed.move_toward(ground_dir * ground_speed, (ground_acel if moving else ground_decel) * delta)
Or:
var moving = true if dir.dot(get_real_velocity()) > 0 else false
speed = speed.move_toward(ground_dir * ground_speed, (ground_acel if moving else ground_decel) * delta)