Ogre SkeletonAnimation addFrame error
Posted: Wed Dec 05, 2018 2:56 pm
Hi,
I guess there is a mistake for the code of SkeletonAnimation::addFrame and SkeletonAnimation::setFrame :
If the "mCurrentFrame" value is negative (which is possible with "fmod" as stated by the 'if' and the doc of fmod) the value mCurrentFrame is computed badly because
will be greater than maxFrame, and lead to incorrect animation as I saw in my software...
the good version might be in fact :
for exemple :
I guess there is a mistake for the code of SkeletonAnimation::addFrame and SkeletonAnimation::setFrame :
Code: Select all
mCurrentFrame = fmod( mCurrentFrame, maxFrame );
if( mCurrentFrame < 0 )
mCurrentFrame = maxFrame - mCurrentFrame;
Code: Select all
mCurrentFrame = maxFrame - mCurrentFrame;the good version might be in fact :
Code: Select all
mCurrentFrame = mCurrentFrame + maxFrame; // or simply "mCurrentFrame += maxFrame;" Code: Select all
mCurrentFrame = fmod( -5.1, 3.0 ); // mCurrentFrame = -2.1
if( mCurrentFrame < 0 ) // true
mCurrentFrame = -2.1 + 3.0; // mCurrentFrame = 0.9 => good behavior