Add sanity check to prevent crashes when Animated Model has NaN in skeleton pose
#2118
This commit is contained in:
@@ -282,6 +282,20 @@ void AnimGraphExecutor::Update(AnimGraphInstanceData& data, float dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if !BUILD_RELEASE
|
||||||
|
{
|
||||||
|
// Perform sanity check on nodes pose to prevent crashes due to NaNs
|
||||||
|
bool anyInvalid = animResult->RootMotion.IsNanOrInfinity();
|
||||||
|
for (int32 i = 0; i < animResult->Nodes.Count(); i++)
|
||||||
|
anyInvalid |= animResult->Nodes.Get()[i].IsNanOrInfinity();
|
||||||
|
if (anyInvalid)
|
||||||
|
{
|
||||||
|
LOG(Error, "Animated Model pose contains NaNs due to animations sampling/blending bug.");
|
||||||
|
context.Data = nullptr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
SkeletonData* animResultSkeleton = &skeleton;
|
SkeletonData* animResultSkeleton = &skeleton;
|
||||||
|
|
||||||
// Retarget animation when using output pose from other skeleton
|
// Retarget animation when using output pose from other skeleton
|
||||||
|
|||||||
Reference in New Issue
Block a user