Fixing it with fix()
two ways to keep the particle from dropping
fxing it in space
why are fixed particles necessary?
Example 3
- multiple particles with different names
- fix()
|
PSystem ps;
void setup() {
size(500,500);
ps = (PSystem)loadPlugin("PSystem");
Particle 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.setGravity(0.5);
}
void loop() {
background(#99CCCC);
ps.draw();
}
|