There are two versions:
Update( float eyeYaw, float eyePitch )
- Manages ambient, looping animations (running/swimming, aiming, breathing) based on player velocity and look direction every frame. Tip:
CMultiPlayerAnimStatewill have your model playing one of the
ACT_MPactivities (search in Visual Studio's Class View for a list). You will probably want to add activity translation tables to your weapons to turn these into activities pertaining to the weapon currently being held. Missing or incomplete translation tables are the number one cause of unanimated models.Note:Your player model must be set up with the appropriate blend sequences for this to work. Unfortunately there are several different schemes floating around: Ep1, OB and Counter-Strike players are all driven differently. Check
SetupPoseParameters()to see what your AnimState object is looking for.
DoAnimationEvent( PlayerAnimEvent_t event, int nData = 0 )
- Begins a discrete, event-based animation (crouching, shooting, reloading) whenever called.
PlayerAnimEvent_tis an enum value that defines what type of animation event this is; it is translated into an activity elsewhere depending on the status of the player (weapon held, swimming, etc).
Implementation is complex, and requires editing several classes. See SDK Skeleton's multiplayer components for a finished product.
Dispatching to clients
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.