UTIL_Tracer
Jump to navigation
Jump to search


This article needs more
links to other articles to help
integrate it into the encyclopedia. Please help improve this article by adding links
that are relevant to the context within the existing text.
January 2024



January 2024


UTIL_Tracer is a UTIL provided in the Source code for creating bullet traces. It supports new particle-based tracers and old-style hardcoded particle tracers. See List of Client Effects for effects you can use.
Todo: Picture example.
Todo: Fill out rest of Input, it's not clear from the function what each one does.
Usage
//-----------------------------------------------------------------------------
// Purpose: Make a tracer effect using the old, non-particle system, tracer effects.
// Input : &vecStart - Vector of where to start the tracer
// &vecEnd - Vector of where to end the tracer
// iEntIndex -
// iAttachment -
// flVelocity -
// bWhiz -
// *pCustomTracerName - Dispatches a tracer with this name instead of the default "Tracer"
//-----------------------------------------------------------------------------
void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex, int iAttachment, float flVelocity, bool bWhiz, char *pCustomTracerName )
//-----------------------------------------------------------------------------
// Purpose: Make a tracer effect using the old, non-particle system, tracer effects.
// Input : &vecStart - Vector of where to start the tracer
// &vecEnd - Vector of where to end the tracer
// iEntIndex -
// iAttachment -
// flVelocity -
// bWhiz -
// *pCustomTracerName - Dispatches a tracer with this name instead of the default "Tracer"
// iParticleID -
//-----------------------------------------------------------------------------
void UTIL_Tracer( const Vector &vecStart, const Vector &vecEnd, int iEntIndex,
int iAttachment, float flVelocity, bool bWhiz, const char *pCustomTracerName, int iParticleID )
Examples
//This example uses the first (non overloaded) function. It creates a custom "StriderTracer" tracer.
void CNPC_Strider::MakeTracer( const Vector &vecTracerSrc, const trace_t &tr, int iTracerType )
{
float flTracerDist;
Vector vecDir;
Vector vecEndPos;
vecDir = tr.endpos - vecTracerSrc;
flTracerDist = VectorNormalize( vecDir );
UTIL_Tracer( vecTracerSrc, tr.endpos, 0, TRACER_DONT_USE_ATTACHMENT, 5000, true, "StriderTracer" );
}
void CPropJeep::DrawBeam( const Vector &startPos, const Vector &endPos, float width )
{
//Tracer down the middle
UTIL_Tracer( startPos, endPos, 0, TRACER_DONT_USE_ATTACHMENT, 6500, false, "GaussTracer" );
//So on
}
int iAttachment = GetTracerAttachment();
switch ( iTracerType )
{
case TRACER_LINE:
UTIL_Tracer( vNewSrc, tr.endpos, iEntIndex, iAttachment, 0.0f, true, pszTracerName );
break;
case TRACER_LINE_AND_WHIZ:
UTIL_Tracer( vNewSrc, tr.endpos, iEntIndex, iAttachment, 0.0f, true, pszTracerName );
break;
}
if( m_iszTracerType != NULL_STRING )
{
UTIL_Tracer( GetAbsOrigin(), vecEnd, 0, TRACER_DONT_USE_ATTACHMENT, 5000, true, STRING(m_iszTracerType) );
}
else
{
UTIL_Tracer( GetAbsOrigin(), vecEnd, 0, TRACER_DONT_USE_ATTACHMENT, 5000, true );
}