log in | register | forums
Show:
Go:
Forums
Username:

Password:

User accounts
Register new account
Forgot password
Forum stats
List of members
Search the forums

Advanced search
Recent discussions
- Drag'N'Drop Autumn edition now available (News:)
- !DualHead puts 2 screens in one (News:)
- RISC OS London Show 2017 - Notes from the talks (News:6)
- November News (News:)
- !Organizer 2.28 reviewed (News:2)
- !OBrowse reviewed (News:10)
- Aemulor (Gen:16)
- DDE reaches release 28 and above (News:)
- Elesar quicks dispels stormy clouds (News:2)
- RISC OS London Show 2017 (News:)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
Site Search
 
Article archives
The Icon Bar: Programming: Particle simulation
 
  Particle simulation
  andreww (12:26 30/4/2001)
  davidm (17:07 1/5/2001)
    andreww (09:46 2/5/2001)
 
Andrew Message #86359, posted by andreww at 12:26, 30/4/2001
AA refugee
Posts: 555
Could anybody please tell me what mathemaical formula's are used for basic particle simulations?
For example a simple firework or cascade effect?
Regards,
Andrew
  ^[ Log in to reply ]
 
David McEwen Message #86360, posted by davidm at 17:07, 1/5/2001, in reply to message #86359
Member
Posts: 100
Since I don't know if you are talking 2d or 3d I'll just talk generally :

A particle system should be very simple at the core. - if your system isn't then its alot of processor hit for not much effect... Each particle should be a structure with position, directional vector, speed, life span and gravity.
To create a cascade effect just simply emit particles from point a with a direction that takes them up and give lifespan of x frames and some gravity. Simple ;-)

So in a frame you move each particle according to its direction vector, apply gravity and see if its decayed. This can all obviously be extended but that is basically all you need.

There should be stuff on Flipcode and there is a rather nice 2d program called the Explosion Graphics Generator (EGG) on the PC that has source available that you can look through.

Hope that helps.

  ^[ Log in to reply ]
 
Andrew Message #86361, posted by andreww at 09:46, 2/5/2001, in reply to message #86360
AA refugee
Posts: 555
Yes it does, thanks.

What I'll need to do though is in addition to implementing x and y velocity and gravity, to alter this velocity perhaps to take accout of loss of energy in an explosion for example.

I'm thinking of having particles exploding from a point and cascading downwards so I would give the particles a diagonal upwards vector and then reduce the velocity or perhaps just increase gravity to simulate loss of energy.

Alternatively, if the explosion was in space then I could just use circular explosions and include the lifespan element as opposed to dropping off screen.

Andrew

[Edited by andreww at 00:26, 3/5/2001]

  ^[ Log in to reply ]
 

The Icon Bar: Programming: Particle simulation