UTIL_BubbleTrail
Jump to navigation
Jump to search
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
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
This article is an orphan, meaning that few or no articles link to it.
You can help by adding links to this article from other relevant articles.
January 2024
You can help by adding links to this article from other relevant articles.
January 2024
UTIL_BubbleTrail is a UTIL provided in the Source code for a trail of bubbles.
Usage
//-----------------------------------------------------------------------------
// Purpose:
//
// Input : Vector &from | Where the bubble trail should emit from
// Input : Vector &to | Where the bubble trail should go
// Input : int - count | How many bubbles
// Output :
//-----------------------------------------------------------------------------
void UTIL_BubbleTrail( const Vector& from, const Vector& to, int count );
Examples
//-----------------------------------------------------------------------------
// Think every 0.1 seconds to make bubbles if we're flying through water.
//-----------------------------------------------------------------------------
void CHunterFlechette::BubbleThink()
{
//What this does is think every 0.1 seconds, and checks if the Flechette is in water.
//If it's not in the water, it exits the function and checks again in 0.1s.
//If it is in the water, then it creates a bubble trail every 0.1s.
//SetNextThink having two params has something to do with SetContextThink.
SetNextThink( gpGlobals->curtime + 0.1f, s_szHunterFlechetteBubbles );
//If it's not in the water, just check again in 0.1s.
if ( GetWaterLevel() == 0 )
return;
//Create a bubble trail, starting at the Origin-Velocity, so
//the origin - 0.1 it's velocity, or behind the Flechette
//The bubbles will head towards it's actual origin, like they were pulled
//forward by it's movement through the water.
UTIL_BubbleTrail( GetAbsOrigin() - GetAbsVelocity() * 0.1f, GetAbsOrigin(), 5 );
}