Page 1 of 1

[fixed]buildFrameNr does not clamp values

Posted: Thu Dec 02, 2010 5:09 am
by hach-que
It's possible for the engine to crash if the timeMs value is relatively large, causing the CurrentFrameNr to still be larger than the end frame. In the current code it'll only reduce it by a maximum amount of (EndFrame-StartFrame), whereas it should really reduce it until it's within the allows values.

On line 114 of CAnimatedMeshSceneNode.cpp,

Code: Select all

	else if (Looping)
	{
		// play animation looped
		CurrentFrameNr += timeMs * FramesPerSecond;
		if (FramesPerSecond > 0.f) //forwards...
		{
			if (CurrentFrameNr > EndFrame)
				CurrentFrameNr -= (EndFrame-StartFrame);
		}
		else //backwards...
		{
			if (CurrentFrameNr < StartFrame)
				CurrentFrameNr += (EndFrame-StartFrame);
		}
should be

Code: Select all

	else if (Looping)
	{
		// play animation looped
		CurrentFrameNr += timeMs * FramesPerSecond;
		if (FramesPerSecond > 0.f) //forwards...
		{
			while (CurrentFrameNr > EndFrame)
				CurrentFrameNr -= (EndFrame-StartFrame);
		}
		else //backwards...
		{
			while (CurrentFrameNr < StartFrame)
				CurrentFrameNr += (EndFrame-StartFrame);
		}

Posted: Thu Dec 02, 2010 8:55 am
by hybrid
Yes, this should belong to a known problem in the frame number calculation which we will work on in the future.

Posted: Thu Dec 02, 2010 9:48 am
by CuteAlien
That's fixed already in 1.7.2, you are probably still using 1.7.1.