PDA

View Full Version : Initiating new animation sequences


Beky
07-25-2007, 12:41 PM
I'm trying to initiate new animation sequences via any user input doesn't really matter. I'm in thirdperson so I'm using HL2_Player::SetAnimation (PLAYER_ANIM playerAnim). I've called it from the PlayerUse and from my VGUI onMouseClick. It is getting to the line where the idealActivity is set and if I rout the animation to an already actively bound animation process like Idle or Run the sequence runs fine. So where are the preprocesses or flags needing to be run through to have a new animation sequence initiate and play through properly. I've gone through just about everything I could think of. I've searched through player gamemovement movehelper_client movehelper_server and so on. A quick pointer would be nice! :)

Beky
07-26-2007, 10:31 AM
After a bit of screwing around I'm now here

void CHL2_Player::PostThink( void )
{
BaseClass::PostThink();

if ( !g_fGameOver && !IsPlayerLockedInPlace() && IsAlive() )
{
HandleAdmireGlovesAnimation();
}
}


BaseClass::PostThink();

This seems to be the problem and I'm not sure where it's code resides or what it's referencing is this CBasePlayer ??


This is where I'm calling the animation and if I disable the call to BaseClass::PostThink(); it runs the anim and also with the call I get my DevMsg so all is running through. My Think however is not being called, if I'm correct I've coded the run to play it all instantaneously??

void CRozActions::ActionThink()
{

HandleLiftCot();
DevMsg("GG");

SetNextThink( gpGlobals->curtime + 0.1f );

}

void CRozActions::StartLiftCot( void )
{
CBasePlayer *pPlayer=UTIL_PlayerByIndex(1);

if ( pPlayer != NULL )
{

PLAYER_ANIM idealAnimation = PLAYER_USE;

if ( idealAnimation != NULL)
{
pPlayer->SetAnimation( idealAnimation );
m_flLiftCotTime = gpGlobals->curtime + pPlayer->SequenceDuration( idealAnimation );
}
}

HandleLiftCot();
}

void CRozActions::HandleLiftCot(void)
{
CBasePlayer *pPlayer=UTIL_PlayerByIndex(1);

if ( pPlayer != NULL)
{
if ( m_flLiftCotTime != 0.0 )
{
if ( m_flLiftCotTime > gpGlobals->curtime )
{
pPlayer->m_flPlaybackRate = 20.0f;
pPlayer->StudioFrameAdvance( );
}
else if ( m_flLiftCotTime < gpGlobals->curtime )
{
m_flLiftCotTime = 0.0f;

}
}
}
else
m_flLiftCotTime = 0.0f;

SetThink(&CRozActions::ActionThink);
SetNextThink( gpGlobals->curtime + 0.1f );

}

Marine
07-26-2007, 11:14 AM
This is where I'm calling the animation and if I disable the call to BaseClass::PostThink(); it runs the anim

:) Find the base class of CHL2_Player and look in the PostThink function :)