Hands model as separate viewmodel entity

Grab your favourite IDE and tinker with the innards of game engines

Hands model as separate viewmodel entity

Postby atrblizzard on Fri Nov 25, 2011 12:20 am

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 );
   bool   m_bActive;
   float   m_flNextChangeTime;

LINK_ENTITY_TO_CLASS( hands_model, CHandsEntity );
// Start of our data description for the class
   // Save/restore our active state
   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.
Joined: Sun Oct 17, 2010 12:24 pm

Return to Programming

Who is online

Users browsing this forum: No registered users