PDA

View Full Version : Attach entity to model


Nial
07-18-2007, 06:57 AM
I'm trying to attach an entity to a player model. Here's some quick test code I came up with:


pFiremanAttachment = ( NbNFiremanAttachment * )CreateEntityByName( "nbn_fireman_attachment" );

Vector aVec;
QAngle aAngle;

int aId = LookupAttachment( "anim_attachment_LH" );
GetAttachment( aId, aVec, aAngle );

pFiremanAttachment->SetAbsOrigin( aVec );
pFiremanAttachment->SetAbsAngles( aAngle );
pFiremanAttachment->SetParent( this, aId );
pFiremanAttachment->Spawn();


This works but the attachment seems to 'jitter'. I wanted to check that I'm going about this the right way.

lodle
07-18-2007, 09:06 AM
Prob need to set it slightly away from the model as it might be colliding causing the jitter. Just an idea. :D

Nial
07-18-2007, 11:24 AM
lodle, I hadn't considered the collision problem. The attachment is used purely for decoration. As such, I tried turning its collision off:


SetSolid( SOLID_NONE );
SetCollisionGroup( COLLISION_GROUP_NONE );


Sadly, the model still jitters and moves, slightly. Am I missing a step, here?

lodle
07-18-2007, 12:11 PM
Hmm im stumped as this is out of my knowledge space. Sorry

Ging
07-19-2007, 05:23 PM
Is the attached model only server side?

It might be a prediction issue (ie, it's having to rely on the entity it's attached to for prediction)