UTIL_Smoke

From Valve Developer Community
Revision as of 07:28, 5 December 2011 by Mattshu (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UTIL_Smoke is a UTIL provided in the Source code for creating smoke. This appears to be a hardcoded particle smoke, so it may be wiser to use a Particle System based smoke instead.


Usage

//-----------------------------------------------------------------------------
// Purpose: Creates smoke at the origin of specified scale at specified framerate
//        
// Input  : &origin - Worldspace vector to emit smoke from
//          scale - Scale of the smoke particles
//          framerate - framerate of playback 
// Output : 
//-----------------------------------------------------------------------------
void UTIL_Smoke( const Vector &origin, const float scale, const float framerate )

Examples

void CNPC_Stalker::DoSmokeEffect( const Vector &position )
{
	if ( gpGlobals->curtime > m_nextSmokeTime )
	{
		m_nextSmokeTime = gpGlobals->curtime + 0.5;
		UTIL_Smoke(position, random->RandomInt(5, 10), 10);
	}
}
// --------------------------------------
//  Smoke or bubbles effect
// --------------------------------------
//If we're in water, we create bubbles
if (UTIL_PointContents ( GetAbsOrigin() ) & MASK_WATER)
{
	UTIL_Bubbles(GetAbsOrigin()-Vector(3,3,3),GetAbsOrigin()+Vector(3,3,3),10);
}
//Otherwise, just create some smoke
else 
{
	UTIL_Smoke(GetAbsOrigin(), random->RandomInt(5, 10), 10);
}