log in | register | forums


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

Advanced search
Recent discussions
- I want to digitise some A3010 software - ONLY COPY (Gen:5)
- RISC OS ports website (News:5)
- For Swaps/Trade Acorn User/Archi World Magazine Collection (Gen:5)
- More Acorn Magazine nostalgia (News:)
- RISC OS London Show 2018 (News:)
- NetSurf or Iconbar? (Site:3)
- September News round-up (News:)
- DDE tools updated to DDE28c (News:)
- Orpheus hits crowdfunding target (News:2)
- Orpheus launch crowdfunding campaign (News:5)
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 (13:26 30/4/2001)
  davidm (18:07 1/5/2001)
    andreww (10:46 2/5/2001)
Andrew Message #86359, posted by andreww at 13: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?
  ^[ Log in to reply ]
David McEwen Message #86360, posted by davidm at 18:07, 1/5/2001, in reply to message #86359
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 10: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.


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

  ^[ Log in to reply ]

The Icon Bar: Programming: Particle simulation