Game Development Community

Animation question

by Jason Green · in Torque Game Builder · 03/30/2005 (2:11 am) · 3 replies

I have a character that squats when I press the down arrow and stands back up when I release the key. The animation is not cycling but it always goes back to the starting frame. Is there a way to make the animation stop and stay on the last frame?

#1
03/30/2005 (2:28 am)
That is a known bug that will be fixed in the next release.
#2
03/30/2005 (2:32 am)
Oh well. I guess I'll have to wait. Thanks for the heads up
#3
03/30/2005 (3:04 am)
Jason: Quickie fix. (In fxAnimationController2D::updateAnimation (fxAnimationController2D.cc)

// Check if the animation has finished.
	if ( !mConfigDataBlock->mAnimationCycle && mCurrentTime >= mTotalIntegrationTime)
	{
		// Animation has finished.
		//mAnimationFinished = true;
		mCurrentFrameIndex = mMaxFrameIndex ;
		mCurrentFrameRegion = mConfigDataBlock->mImageMapDataBlock->getImageMapRegion(mConfigDataBlock->mFramesList[mCurrentFrameIndex]);

		// Are we restoring the animation?
		if ( mAutoRestoreAnimation )
		{
			// Yes, so play last animation.
			playAnimation( mLastAnimationName, false );
		}
	}
Note: Use this only if you feel comfortable editing and compiling the engine, as GG nor I will support it. This will be superceeded by Melv's fix in the engine, this is just a fugly hack to get non-cycled animations to hold last frame.