Game Development Community

Sprinting Animation Troubles

by BryceSquared · in Torque 3D Professional · 10/05/2009 (12:03 pm) · 4 replies

I have written up a little line for getting my sprinting animation working:
if (Con::getBoolVariable("$mvSprint") && ((Con::getFloatVariable("$mvForwardAction") !=0) || (Con::getFloatVariable("$mvBackwardAction") != 0) || 
		  (Con::getFloatVariable("$mvLeftAction") != 0) || (Con::getFloatVariable("$mvRightAction") != 0))&& mActionAnimation.action != PlayerData::SprintAnim) {  
			 setActionThread(PlayerData::SprintAnim,true,false,false);
			 return;
         }

but in game the player seems to be starting the animation before it is complete... so i get a silly pose that twitches before starting again. What should I do?

#1
10/05/2009 (1:31 pm)
What about creating a new Pose called SprintPose?
Look where crouch and prone Poses are called and how they work, then you could set up different speed and animations for it =)

Im not sure if it can work though, still a newb ;)
#2
10/05/2009 (2:01 pm)
else if (mFalling)
   {
      // Not in contact with any surface and falling
      action = PlayerData::FallAnim;
   }
   
   //sprinting>> 
   else if (mSprinting)
   {
	   	 action = PlayerData::SprintAnim;
	     if (mVelocity > 0)
			 forward = true;
		 else
			 forward = false;

   }
   //sprinting<<
   
   else if ( mSwimming )

I've had sprinting working since beta 2, if you need more, let me know
#3
10/05/2009 (2:04 pm)
a bit more to help you:

else if ( mPose == CrouchPose )
            moveSpeed = getMax(mDataBlock->maxCrouchForwardSpeed * move->y,
                               mDataBlock->maxCrouchSideSpeed * mFabs(move->x));
         else // StandPose//BEGIN sprint CHANGED
            moveSpeed = getMax(mDataBlock->maxForwardSpeed * tempSprintSpeedMult * move->y,
                               mDataBlock->maxSideSpeed * tempSprintSpeedMult * mFabs(move->x));//END sprint CHANGED
      }
      else
      {
         if ( mSwimming )
#4
10/05/2009 (7:11 pm)
thanks deepscrath i got it working.

I needed to set mSprinting to true so the pose would work so I just added this in updateMove

// Set the sprinting pose
    if(move->sprint != mSprinting && ((Con::getBoolVariable("$mvForwardAction") != 0) || (Con::getBoolVariable("$mvBackwardAction") != 0) ||
	   (Con::getBoolVariable("$mvLeftAction") != 0) || (Con::getBoolVariable("$mvRightAction") != 0)))
   {
	   mSprinting = move->sprint;
   }
	else{ mSprinting = move->sprint; }