Particle Systems in Processing    
     
09.27.04

<  ^  >

Fixed isn't stationary

 

Fixed simply means unaffected by the particle system dynamics

we can do whatever we want with it

 

Example 5

  • scope!
  • setPos
  • moving particles manually

 

PSystem ps;

Particle p1;

void setup() {
  size(500,500);
  ps = (PSystem)loadPlugin("PSystem");
  
  p1 = new Particle();
  p1.setPos(width / 2 - 10, height/2, 0);
  p1.fix();
  
  Particle p2 = new Particle();
  p2.setPos(width / 2 + 10, height/2, 0);
  
  ps.addParticle(p1);
  ps.addParticle(p2);
  
  ps.addSpring(p1, p2);
  
  ps.setGravity(0.5);

}

void loop() {
  background(#99CCCC);
  p1.setPos(width / 2 + 200 * sin(frame/50.0), height/2, 0);
  ps.draw();
}