UTIL ParticleTracer: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (The original reason for the {{wrongtitle}} was to add in the underscore to the name.)
m (Nesciuse moved page UTIL ParticleTracer/en to UTIL ParticleTracer without leaving a redirect: Move en subpage to basepage)
 
(9 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{wrongtitle|UTIL_ParticleTracer}}
{{LanguageBar}}
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 [http://developer.valvesoftware.com/wiki/Particle_System_Initializers#Move_Particles_Between_2_Control_Points Move Particles Between 2 Control Points] initializer.  
[[Category:UTIL]]
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 [[Particle_System_Initializers#Move_Particles_Between_2_Control_Points|Move Particles Between 2 Control Points]] initializer.  


== Usage ==
== Usage ==
Line 18: Line 19:


== Examples ==
== Examples ==
You can override the default tracer in '''basecombatweapon_shared.cpp''' by replacing the switch statement around line 749:
You can override the default tracer in <tt>basecombatweapon_shared.cpp</tt> by replacing the switch statement around line 749:


<source lang=cpp>
<source lang=cpp>
switch ( iTracerType )
UTIL_ParticleTracer("tracer_bullet", vNewSrc, tr.endpos, entindex(), iAttachment, iTracerType == TRACER_LINE_AND_WHIZ);
{
    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;
}
</source>
</source>
[[Category:Programming]]
[[Category:UTIL]]

Latest revision as of 11:50, 12 July 2024

English (en)Translate (Translate)

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:

UTIL_ParticleTracer("tracer_bullet", vNewSrc, tr.endpos, entindex(), iAttachment, iTracerType == TRACER_LINE_AND_WHIZ);