UTIL_BloodDrips

From Valve Developer Community
Jump to: navigation, search

UTIL_BloodDrips is a UTIL provided in the Source code for creating drips of blood. It appears to support directions other than down. It supports anywhere between 1-255 as an amount.

If the color is BLOOD_COLOR_MECH (3), it will create sparks and smoke puffs instead of blood drips!

If the color is BLOOD_COLOR_RED (1) or others, it will call UTIL_BloodImpact with the same settings.

Usage

//-----------------------------------------------------------------------------
// Purpose: 
//          
// Input  : Vector &origin    | Where the blood drip should emit from
// Input  : Vector &direction | Direction they should drip
// Input  : int - Color       | BLOOD_COLOR_MECH has a certain usage. Otherwise, it calls UTIL_BloodImpact.
// Input  : int - Amount      | Amount of drips(?) - TODO: Test this
// Output : 
//-----------------------------------------------------------------------------
void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color, int amount )


Examples

int i;
Vector vecSpot;
Vector vecDir;

//Create 4 random spots of blood drips
for ( i = 0 ; i < 4; i++ )
{
        //Gets the center of an object in world-space coordinates
	vecSpot = WorldSpaceCenter();

	vecSpot.x += random->RandomFloat( -12, 12 ); 
	vecSpot.y += random->RandomFloat( -12, 12 ); 
	vecSpot.z += random->RandomFloat( -4, 16 ); 

	UTIL_BloodDrips( vecSpot, vec3_origin, BLOOD_COLOR_YELLOW, 50 );
}