I want the beam that I have created (simulating the orange beam of the tau cannon) to come out from an $attachment that I defined from the QC file of my model, and not from the model's origin, as you can see in the image that I attach here: This is the bunch of code I wrote so far:
void CHEVScientistGauss :: HandleAnimEvent( MonsterEvent_t *pEvent )
(...)
case HEVGAUSS_AE_SHOOT_GAUSS:
{
if (m_hEnemy != NULL)
{
TraceResult tr;
Vector vecSrc, vecAngles;
vecAngles = ShootAtEnemy( vecSrc );
UTIL_TraceLine( vecSrc, vecSrc + vecAngles * 1024, dont_ignore_monsters, ENT( pev ), &tr);
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
if (pEntity != NULL && pEntity->pev->takedamage)
{
ClearMultiDamage();
pEntity->TraceAttack( pev, gSkillData.hevscientistGaussDmg, pev->velocity, &tr, DMG_SHOCK );
ApplyMultiDamage( pev, pev );
}
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_BEAMENTPOINT );
WRITE_SHORT( entindex() );
WRITE_COORD( tr.vecEndPos.x );
WRITE_COORD( tr.vecEndPos.y );
WRITE_COORD( tr.vecEndPos.z );
WRITE_SHORT( m_iBeam );
WRITE_BYTE( 0 );
WRITE_BYTE( 0 );
WRITE_BYTE( 1 );
WRITE_BYTE( 10 );
WRITE_BYTE( 0 );
WRITE_BYTE( 255 );
WRITE_BYTE( 128 );
WRITE_BYTE( 0 );
WRITE_BYTE( 128 );
WRITE_BYTE( 0 );
MESSAGE_END();
EMIT_SOUND( ENT(pev), CHAN_WEAPON, "weapons/gauss2.wav", 1, ATTN_NORM );
}
}
break;
Thanks guys for your time.