Game Development Community

AI Characters Change Pose Problem

by Boğaz Harbi · in Torque 3D Professional · 12/30/2009 (10:23 am) · 2 replies

I'm working with Torque3D 1.1 Alpha and I changed at the end of UpdateMove function in player.cpp as follows:

from...
// Update the PlayerPose
   Pose desiredPose = mPose;

   if ( mSwimming )
      desiredPose = SwimPose; 
   else if ( runSurface && move->trigger[3] && canCrouch() )     
      desiredPose = CrouchPose;
   else if ( runSurface && move->trigger[4] && canProne() )
      desiredPose = PronePose;
   else if ( canStand() )
      desiredPose = StandPose;

   setPose( desiredPose );

to...
// Update the PlayerPose
   Pose desiredPose = mPose;

   if ( mSwimming )
      desiredPose = SwimPose; 
   else if ( runSurface && move->trigger[3] && canCrouch() && !dStricmp(getClassName(), "Player")) //BHD
      desiredPose = CrouchPose;
   else if ( runSurface && move->trigger[4] && canProne() && !dStricmp(getClassName(), "Player")) //BHD
      desiredPose = PronePose;
   else if ( runSurface && (Con::getBoolVariable("$isSprinted",0)==true) && canSprint() && !dStricmp(getClassName(), "Player")) //BHD
      desiredPose = SprintPose;
   else if ( canStand() )
      desiredPose = StandPose;

   if( !dStricmp(getClassName(), "Player") )
           setPose( desiredPose ); 
   else
   {
	   Pose myPronePose = mPose;
           myPronePose = PronePose;
	   setPose( myPronePose );

	   if( !dStricmp( this->getDataField(StringTable->insert( "pose" ), 0) , "Crouch") )
	   {
			//Con::printf("Name : %s", this->getName());
			Pose myCrouchPose = mPose;
			myCrouchPose = CrouchPose;
			setPose( myCrouchPose );
	   }
   }

My goal as the dynamics of AI characters and change their position and that all AIBot class "pose" I've added a feature named. This code also pose value, for example, "Crouch" of the characters, crouching is required.

Likewise, of the function into pickActionAnimation have added the relevant code. As shown in the video below when Crouch pose value of the character box, change the way I want, but animation is not installed.

What could be the reason for this, I am waiting for your help, especially Steve I need your help I guess ..

About the author

We are working on FPS game project called Boğaz Harbi : Epic of Gallipoli War at Kodgraf Game Studio in Ankara, Turkey. http://www.bogazharbi.com/en http://www.bogazharbigame.com http://twitter.com/bogazharbigame http://facebook.com/bogazharbigame


#1
12/30/2009 (11:25 am)
lol, I don't do cpp, so can't be terribly helpful here.

However, have you thought of just making a console method for the existing "setPose" function?

Also, though it's for an older 3D engine, there is a resource for adding multiple poses (before they got a version integrated with the engine) here, I think that Bryce uses a version of this for his Tactical AI Demos.
#2
12/30/2009 (1:04 pm)
ConsoleMethod( Player, setPose, void, 3, 3, "(int poseID)")
{
	U32 action = dAtoui(argv[2]);
	Player::Pose myPose;

	if(action == 1)
	{
		myPose = Player::Pose::CrouchPose;
		object->setPose(myPose);
	}
}

Thank you Steve, like you say it is working to control the above code I have written roughly. But, the box size such as "Crouch" positions but the animation is not installed as before..

This must be a solution, right?