So I have set up a clamp to stop my throttle from going over or under an amount.
This works fine but if I hold down my accelerate button the value will go over the amount but not by much, I don’t mind this much but its when I brake and my speed goes into the minuses and I start to reverse that I get annoyed.
I don’t know how to fix this and didn’t see anyone else with this problem so help would be really nice.
Switch the order of the lines:
Throttle = Mathf.Clamp(Throttle,0,MaxThrottle);
Throttle +=Input.GetAxis("Throttle");
to
Throttle +=Input.GetAxis("Throttle");
Throttle = Mathf.Clamp(Throttle,0,MaxThrottle);