We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9e11ed commit fcdb49bCopy full SHA for fcdb49b
rts/Sim/MoveTypes/HoverAirMoveType.cpp
@@ -687,8 +687,11 @@ void CHoverAirMoveType::UpdateBanking(bool noBanking)
687
rightDir2D = frontDir.cross(UpVector);
688
689
690
- if (!owner->upright)
691
- wantedPitch = (circlingPos.y - owner->pos.y) / circlingPos.distance(owner->pos);
+ if (!owner->upright) {
+ // std::max() is here to guard around the case when circlingPos == owner->pos,
692
+ // which caused NaNs all over the place
693
+ wantedPitch = (circlingPos.y - owner->pos.y) / std::max(0.01f, circlingPos.distance(owner->pos));
694
+ }
695
696
wantedPitch *= (aircraftState == AIRCRAFT_FLYING && flyState == FLY_ATTACKING && circlingPos.y != owner->pos.y);
697
currentPitch = mix(currentPitch, wantedPitch, 0.05f);
0 commit comments