Basicly, what I want to achieve is to have a separate client model entity, which will use a hand model, which gets attached to the weapon viewmodel entity. Both the hands and the weapon models have their own animations, and the hands models have all the animations for the weapon viewmodels.
From what I know, the entity has to be created, initialized as client entity, have its parent set to the viewmodel, and have the bones merged to the viewmodel.
But I am unsure where this has to be spawned and initialized and how exactly it needs to be done in order to get the proper result.
- Code: Select all
class CHandsEntity : public CBaseAnimating
DECLARE_CLASS( CHandsEntity CBaseAnimating );
m_bActive = false;
void Spawn( void );
void Precache( void );
void MoveThink( void );
// Input function
void InputToggle( inputdata_t &inputData );
LINK_ENTITY_TO_CLASS( hands_model, CHandsEntity );
// Start of our data description for the class
BEGIN_DATADESC( CHandsEntity )
// Save/restore our active state
DEFINE_FIELD( m_bActive, FIELD_BOOLEAN ),
DEFINE_FIELD( m_flNextChangeTime, FIELD_TIME ),
define ENTITY_MODEL "models/hands/male/shared/v_shared_male_hands.mdl"
void CHandsEntity::Precache( void )
PrecacheModel( ENTITY_MODEL );
void CHandsEntity::Spawn( void )
SetModel( ENTITY_MODEL );
SetSolid( SOLID_BBOX );
UTIL_SetSize( this, -Vector(20,20,20), Vector(20,20,20) );
I doubt the code is any good and I don't really know how to get it spawned over the viewmodel.