Hey bud

I just took a look at the code and valve did some splash code per particle
for I guess Counter-Strike source. If you look in c_effects under
SimulateRain there is a block:

    // No longer in the air? punt.
    if ( !IsInAir( pParticle->m_Pos ) )
    {
        // Possibly make a splash if we hit a water surface and it's in
front of the view.
        if ( m_Splashes.Count() < 20 )
        {
            if ( RandomInt( 0, 100 ) < r_RainSplashPercentage.GetInt() )
            {
                trace_t trace;
                UTIL_TraceLine(vOldPos, pParticle->m_Pos, MASK_WATER, NULL,
COLLISION_GROUP_NONE, &trace);
                if( trace.fraction < 1 )
                {
                    m_Splashes.AddToTail( trace.endpos );
                }
            }
        }

        // Tell the framework it's time to remove the particle from the list
        return false;
    }

You would just replace anything after if ( !IsInAir( pParticle->m_Pos ) )
with your own rules using pParticle->m_Pos as the position to spawn your
effect.
Then you use

DispatchParticleEffect( EFFECT_NAME, pParticle->m_Pos, vecAngles );

Make sure your particle effect is precached and you should be set.

On Tue, Mar 31, 2009 at 4:06 PM, James K <[email protected]> wrote:

> I know the basics of C++, not anything major. The particle demo was done by
> a map-defined particle system, and i'm looking to do what Left4Dead does
> with the splash particles implemented code-wise.
>
> On Tue, Mar 31, 2009 at 6:58 PM, Ryan Sheffer <[email protected]> wrote:
>
> > Well I don't know your experience level. Which part would you like
> > help with? When I get home from school I'll take a look. Valve had a
> > particle system spawn where rain hit in the tech demo and L4D so that
> > code is probably still there for you to alter.
> >
> > Sent from my iPhone
> >
> > On Mar 31, 2009, at 12:26 PM, James K <[email protected]> wrote:
> >
> > > The question is, how?
> > >
> > > On Tue, Mar 31, 2009 at 10:31 AM, Ryan Sheffer <[email protected]>
> > > wrote:
> > >
> > >> I am pretty sure rain just uses a trace, and the end of that trace
> > >> would be where you make your effect, after the time it takes to get
> > >> to
> > >> the ground of course.
> > >>
> > >> Sent from my iPhone
> > >>
> > >> On Mar 30, 2009, at 9:20 PM, James K <[email protected]> wrote:
> > >>
> > >>> I had a friend who had done this, however i cannot contact him to
> > >>> ask how he
> > >>> did it. I know rain is handled in c_effects.cpp, but i don't know
> > >>> enough
> > >>> about coding to do something like this (I've got to start learning
> > >>> somewhere
> > >>> though, right?) How would i go about doing this?
> > >>> _______________________________________________
> > >>> To unsubscribe, edit your list preferences, or view the list
> > >>> archives, please visit:
> > >>> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> > >>>
> > >>
> > >> _______________________________________________
> > >> To unsubscribe, edit your list preferences, or view the list
> > >> archives,
> > >> please visit:
> > >> http://list.valvesoftware.com/mailman/listinfo/hlcoders
> > >>
> > >>
> > > _______________________________________________
> > > To unsubscribe, edit your list preferences, or view the list
> > > archives, please visit:
> > > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> > >
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>


-- 
~Ryan ( skidz )
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to