M PlayerAnimState: Difference between revisions
Jump to navigation
Jump to search
Note:Your player must be using a model set up for player animation for any of this to work. Single-player models are not suitable! Valve don't mind modders lifting their HL2DM models, which are set up correctly.
TomEdwards (talk | contribs) m (category test) |
TomEdwards (talk | contribs) (oh well) |
||
Line 27: | Line 27: | ||
In multiplayer you must dispatch animation events to all onlooking clients, a job which is not performed by <code>CBasePlayer</code>. See [[m_PlayerAnimState/TempEnt]] for the temporary entity used by Valve. | In multiplayer you must dispatch animation events to all onlooking clients, a job which is not performed by <code>CBasePlayer</code>. See [[m_PlayerAnimState/TempEnt]] for the temporary entity used by Valve. | ||
[[Category:CBasePlayer | [[Category:CBasePlayer]] {{DISPLAYTITLE:m_PlayerAnimState}} |
Revision as of 13:22, 31 January 2010
The m_PlayerAnimState
object maintains a player's animation state. It is shared code. There are two versions, CBasePlayerAnimState
and CMultiPlayerAnimState
, and two entry points:
Update( float eyeYaw, float eyePitch )
- Manages ambient, looping animations (running/swimming, aiming, breathing) based on player velocity and look direction every frame. Typically called from:
CBasePlayer::PostThink()
C_BasePlayer::UpdateClientSideAnimation()
DoAnimationEvent()
- Begins a discrete, event-based animation (crouching, shooting, reloading) whenever called.
Implementation

You must define m_PlayerAnimState
in both your client and server classes:
class CMyPlayerClass : public CBasePlayer
{
// ...
CMultiPlayerAnimState* m_PlayerAnimState;
// ...
}
Dispatching
In multiplayer you must dispatch animation events to all onlooking clients, a job which is not performed by CBasePlayer
. See m_PlayerAnimState/TempEnt for the temporary entity used by Valve.