Wednesday, September 16, 2015

Particle Simulators in Java Script

Two particle simulators for in your browser, made with Pete Baron:

A. Deflection-Angle Presets:
(Click-drag the area to centre the spiral)

(Note, preferable to use Google Chrome) 

B. With Attraction & Repulsion Forces:

This forces are similar to those of the Lenard-Jones and Morse Potential.

Box Particle Simulator In Unity

Download here the file to run the GasSimulator in Unity:
Developed with Joshua Pearce
Note: You'll need to download Unity to run the editing interface:
Version 4.6.4 was used, All you need is the free license.

To launch the program: Open Project go to tab Project > Scenes > Scene1 (main) > (Click) Open
Press Play at the top:

You can place particles by clicking in the area, or click-drag to give them a direction, or use the R-key to spawn a group of random particles. (Spacebar is for pause and up/down keys for speed)

• Select Hierarchy: Sim
(Note, the tap 'Clear on Play' may have to be selected at Console to activate this)
Go to Inspector :
File_name to give your simulation a name.
You can record a simulation by using Shift-S to start saving the stream. Shift-L will load a saved stream in correspondence to the File_name.
File_framecount shows the number of frames being recorded.
File_framepos the rate of the loaded stream (Shft-L).
(Note, to have it run/record a simulation in the background while using other programs you'll have to go to: Edit -> project settings -> player, then check "run in background" in the inspector window.)
Time Hertz gives the Iteration rate for how precise the collision detection is.
Cfg_Spawn Count let's use the number of particles you randomly spaw by using the R-key.
Cfg_Trail Size to set the tail of the particles.

• Select tab Hierarchy: Sim > Area1
Go to Inspector for adjusting the size of the Area and Boundary reaction.
Once the simulation is running you can check here the the amount of Particles > Size

• Select tab Hierarchy: Types > Type1
Go to Inspector for creating particles:
- Rotation-axis for how they pivot when colliding.
- Cfg_Mirror All Pieces to mirror the boxes -=I=-
- Pieces-Size for the number of boxes out of which a particle is made.
- For each box it is possible to define a Group Number
With the next options it is possible to define how it interacts with other Groups:
No collision / No reaction / Partial reaction (+value)
- Color each box.
- Width * Height of the box.
- Reaction_mul_head & Reaction mul_tail sets the lerp values.
- Reaction_ratelimit sets the deflection speed.
- Reaction_deflection_d sets the angle of deflection when made contact.
- Reaction_displacement gives a jump distance away from the collision point.

-Constant_speed: All the way at the bottom to set the speed.