otherwise, when dir=-1 and the velocity value is negative, the output from velocity is in the opposite direction than the intended one
otherwise, when dir=-1 and the velocity value is negative, the output from velocity is in the opposite direction than the intended one