// First off, make sure that the gear "tip" is below the ground.
// If it's not, there's no force.
float a = ground[3] - Math::dot3(_pos, ground);
+ _compressDist = -a;
if(a > 0) {
_wow = 0;
_frac = 0;
+ _compressDist = 0;
_rollSpeed = 0;
_casterAngle = 0;
return;
if(_castering) {
_rollSpeed = Math::sqrt(vsteer*vsteer + vskid*vskid);
- _casterAngle = Math::atan2(vskid, vsteer);
+ // Don't modify caster angle when the wheel isn't moving,
+ // or else the angle will animate the "jitter" of a stopped
+ // gear.
+ if(_rollSpeed > 0.05)
+ _casterAngle = Math::atan2(vskid, vsteer);
return;
} else {
_rollSpeed = vsteer;