UTIL BloodImpact: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{wrongtitle|UTIL_BloodImpact}}
{{DISPLAYTITLE:UTIL_BloodImpact}}
UTIL_BloodImpact is a UTIL provided in the Source code for creating a "bloodimpact" effect.  
UTIL_BloodImpact is a [[UTIL]] provided in the Source code for creating a "bloodimpact" effect.  


== Usage ==
== Usage ==

Latest revision as of 00:26, 5 December 2011

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 );
}