how to check if your player is moving backwards unity 3d code example
Example: check velocity is forwards or backwards + unity
//moving forwards
Mathf.Abs(localVelocity.z) > 0.01f
//moving backwards
Mathf.Abs(localVelocity.z) < 0.01f
//moving forwards
Mathf.Abs(localVelocity.z) > 0.01f
//moving backwards
Mathf.Abs(localVelocity.z) < 0.01f