UTIL ParticleTracer

From Valve Developer Community
Revision as of 23:36, 12 April 2011 by Thelonesoldier (talk | contribs) (links - please make the tiny amount of effort to link terms)

Jump to: navigation, search

Template:Wrongtitle UTIL_ParticleTracer is a UTIL provided in the Source code for dispatching bullet tracer effects with the Orange Box particle system. It works by setting control points 0 and 1, where 0 is where the tracer starts and point 1 is where the tracer ends. The particle effect should implement the Move Particles Between 2 Control Points initializer.

Usage

//-----------------------------------------------------------------------------
// Purpose: Make a tracer using a particle effect
//-----------------------------------------------------------------------------
void UTIL_ParticleTracer( const char *pszTracerEffectName, const Vector &vecStart, const Vector &vecEnd, 
				 int iEntIndex, int iAttachment, bool bWhiz )
{
	int iParticleIndex = GetParticleSystemIndex( pszTracerEffectName );
	UTIL_Tracer( vecStart, vecEnd, iEntIndex, iAttachment, 0, bWhiz, "ParticleTracer", iParticleIndex );
}


Examples

You can override the default tracer in basecombatweapon_shared.cpp by replacing the switch statement around line 749:

switch ( iTracerType )
{
     case TRACER_LINE:
          UTIL_ParticleTracer("tracer_bullet", vNewSrc, tr.endpos, entindex(), iAttachment, true);  
	  break;

     case TRACER_LINE_AND_WHIZ:
          UTIL_ParticleTracer("tracer_bullet", vNewSrc, tr.endpos, entindex(), iAttachment, true);  
          break;
}