UTIL_BloodImpact

From Valve Developer Community
Jump to navigation Jump to search

UTIL_BloodImpact is a UTIL provided in the Source code for creating a "bloodimpact" effect.

Usage

//-----------------------------------------------------------------------------
// Purpose: 
//          
// Input  : Vector - &pos | Position to create the Blood Impact at.
// Input  : Vector - &dir | Direction to create the Blood Impact in.
// Input  : int - bloodColor | Type of blood to create. 
// Input  : int - Amount     | Amount of blood impacts to create
// Output : 
//-----------------------------------------------------------------------------
void UTIL_BloodImpact( const Vector &pos, const Vector &dir, int color, int amount )


Examples

//Create 4 different BloodImpact effects, slightly offset from each other. (+/- 12)
for ( int i = 0 ; i < 4 ; i++ )
{
        // Get the center of the object in world-space coordinates
	Vector vecSpot = WorldSpaceCenter();
        //Modify it a bit
	vecSpot.x += random->RandomFloat( -12, 12 ); 
	vecSpot.y += random->RandomFloat( -12, 12 ); 
	vecSpot.z += random->RandomFloat( -4, 16 );

	vecDir.x = random->RandomFloat(-1, 1);
	vecDir.y = random->RandomFloat(-1, 1);
	vecDir.z = 0;
	VectorNormalize( vecDir );

	UTIL_BloodImpact( vecSpot, vecDir, BloodColor(), 1 );
}