Fixed invalid look targets invalidating models

This commit is contained in:
Blixibon 2022-07-17 18:32:30 -05:00
parent a4657d0cf1
commit a9bd90f681

View File

@ -1142,6 +1142,18 @@ void CAI_BaseActor::UpdateHeadControl( const Vector &vHeadTarget, float flHeadIn
ConcatTransforms( worldToForward, targetXform, headXform ); ConcatTransforms( worldToForward, targetXform, headXform );
MatrixAngles( headXform, vTargetAngles ); MatrixAngles( headXform, vTargetAngles );
#ifdef MAPBASE
// This is here to cover an edge case where pose parameters set to NaN invalidate the model.
if (!vTargetAngles.IsValid())
{
Warning( "================================================================================\n"
"!!!!! %s tried to set a NaN head angle (can happen when look targets have >1 importance) !!!!!\n"
"================================================================================\n", GetDebugName() );
vTargetAngles.x = 0;
vTargetAngles.y = 0;
}
#endif
// partially debounce head goal // partially debounce head goal
float s0 = 1.0 - flHeadInfluence + GetHeadDebounce() * flHeadInfluence; float s0 = 1.0 - flHeadInfluence + GetHeadDebounce() * flHeadInfluence;
float s1 = (1.0 - s0); float s1 = (1.0 - s0);