Avoid zero division during animation interpolation

This commit is contained in:
Alexei Kotov 2025-07-18 00:13:01 +03:00
parent 93cb69b012
commit 4a0c998f53

View File

@ -112,7 +112,12 @@ namespace NifOsg
mLastHighKey = it;
mLastLowKey = --it;
float a = (time - mLastLowKey->first) / (mLastHighKey->first - mLastLowKey->first);
const float highTime = mLastHighKey->first;
const float lowTime = mLastLowKey->first;
if (highTime == lowTime)
return mLastLowKey->second.mValue;
const float a = (time - lowTime) / (highTime - lowTime);
return interpolate(mLastLowKey->second, mLastHighKey->second, a, mKeys->mInterpolationType);
}