So for the code i have is:
- Code: Select all
void C_BaseAnimating::ProcessMuzzleFlashEvent()
{
// If we have an attachment, then stick a light on it.
if ( muzzleflash_light.GetBool() )
{
//FIXME: We should really use a named attachment for this
if ( m_Attachments.Count() > 0 )
{
#if defined (SDK_DYNAMIC_FLASH )
{
Vector vAttachment, vAng;
QAngle angles;
GetAttachment( "muzzle" , vAttachment, angles );
AngleVectors( angles, &vAng );
vAttachment += vAng * 2;
dlight_t *dl = effects->CL_AllocDlight ( index );
dl->origin = vAttachment;
dl->color.r = 231;
dl->color.g = 219;
dl->color.b = 14;
dl->die = gpGlobals->curtime + 0.05f;
dl->radius = random->RandomFloat( 245.0f, 256.0f );
dl->decay = 512.0f;
PrecacheParticleSystem( "muzzle_smg1" );
DispatchParticleEffect( "muzzle_smg1", vAttachment, angles );
}
#else
{
Vector vAttachment;
QAngle dummyAngles;
GetAttachment( LookupAttachment( "muzzle" ), vAttachment, dummyAngles );
// Make an elight
dlight_t *el = effects->CL_AllocElight( LIGHT_INDEX_MUZZLEFLASH + index );
el->origin = vAttachment;
el->radius = random->RandomInt( 32, 64 );
el->decay = el->radius / 0.05f;
el->die = gpGlobals->curtime + 0.05f;
el->color.r = 255;
el->color.g = 192;
el->color.b = 64;
el->color.exponent = 5;
}
#endif
}
}
}
However, the muzzle flashes (Both the dlights and the particles) are being created twice, once at the eyes and once at the models crotch, instead of the gun model's muzzle.



