I have this sequence in my .qc file:
- Code: Select all
$sequence Run "poet_run" activity ACT_RUN 1 loop
$sequence StopRun "poet_stop_run" activity ACT_STOP_RUN 1
These are animation of the player preparing an attack
I have added a "ACT_STOP_RUN" and "ACT_RUN" to the lists in ai_activity.h, ai_activity.cpp and activitylist.cpp. In the "enum PLAYER_ANIM" in shareddefs.h I added "PLAYER_STOP_RUN" and "PLAYER_RUN".
I should mention that the game I am working on is seen from a third person view and that the animations are for the player avatar.
In the HL2_Player.cpp I have added
- Code: Select all
else if ( playerAnim == PLAYER_RUN )
{
idealActivity = ACT_RUN;
}
and
- Code: Select all
else if ( idealActivity == ACT_RUN )
{
RestartGesture( Weapon_TranslateActivity( idealActivity ) );
return;
}
(same for PLAYER_STOP_RUN/ACT_STOP_RUN)
I don't understand much of the last code "RestartGesture( ... )".
in gamemovement.cpp in CGameMovement::PlayerMove I have the following:
- Code: Select all
if( player->GetAbsVelocity().Length2D() == 0 && runFlag)
{
player->SetAnimation(PLAYER_STOP_RUN);
}
When the player velocity is zero the player doesn't run anymore and an animation of the player stopping to run is played.
The problem is that the run-animation doesn't stop immediately - which results in the player often taking a step on the ground even though he doesn'trun anymore. The PLAYER_STOP_RUN should be played immediately when the player stops.