Archived

This topic is now archived and is closed to further replies.

neonstar

2D particle systems

Recommended Posts

can anyone give me an example of 2D particle systems that you could use for say bits of fire in an explosion or for pieces of an item when it breaks? i''m trying to give my 2D engine a bit more realism, and i thought that a particle system would be the best way to do it. thanks, david

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Look at this site http://freespace.virgin.net/hugo.elias/models/m_main.htm
there''s a lot of informations.
Giampy

Share this post


Link to post
Share on other sites
Hi neonstar,

I will do my best to help you, but i''ve not yet finished my PSystem 3D.

First you need an array of Particule. I''ve defined it like this

typedef
{
Point2d Position; //Position of particle vs emitter
CVector Momentum; //Force apply on a particule

CMesh *Object; //I have add that for PSystem with a mesh
// like pieces of glass flying around
}Particule;


Then, you defined a Emmiter for those particules

typedef
{
Point2d Position; //Position of emitter in the world
CVector Orientation; //Orientation of emmiter (where
//particules go)

float fSpray; // The Angle of the Emitter Spray

float fTimeBirth; //How long to wiat for another birth
float fBirthTresh; // --

float fLifetime; //How long a particule last..
float fLifeTresh; //I dont want particules to die at the
// same time

float fRandom;

DWORD NbMaxParticules; //Maximum count of particules
LList ListParticules; // A LinkedList Contaning a List of
// all Particules
};



All variables with ''Tresh'', which stand for ''Treshold'', are number to give each PSysteme behave differently.

Like i told you before, i''ve not completed my implentation yet.
But u can what some other things in your DataStruct to make your PSystem make efficent or with more F/X.

You will need a bunch of function to make a usefull use of your PSystem.


void Emitter::AnimateSystem (float fTimeSlice)
{
MakeBirth; // Check if its the right time to add a Particule
// - Birth Time Reach, NbParticule <
// MaxParticules

AnimateParticule; // Animate each particule with is own force
}


You will nedd disply it too, to do that simply parse the LList and show Particule at their respective position


Just hope this with help you...

LowRad.

Share this post


Link to post
Share on other sites