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
- Elsear brings super-fast Networking to Risc PC/A7000/A7000+ (News:)
- Latest hardware upgrade from RISCOSbits (News:)
- Announcing the TIB 2024 Advent Calendar (News:1)
- Code GCC produces that makes you cry #12684 (Prog:39)
- RISCOSbits releases a new laptop solution (News:)
- Rougol November 2024 meeting on monday (News:)
- Drag'n'Drop 14i1 edition reviewed (News:)
- WROCC November 2024 talk o...ay - Andrew Rawnsley (ROD) (News:2)
- October 2024 News Summary (News:3)
- RISC OS London Show Report 2024 (News:1)
Latest postings RSS Feeds
RSS 2.0 | 1.0 | 0.9
Atom 0.3
Misc RDF | CDF
 
View on Mastodon
@www.iconbar.com@rss-parrot.net
Site Search
 
Article archives
Acorn Arcade forums: 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 ]
 

Acorn Arcade forums: Programming: Particle simulation