physics clouds
in
Contributed Library Questions
•
1 year ago
Hi, Im taking a look at the cloud example of physics library. I ave two problems:
1. I dont have the fade.png file, I dont know how it is.
2. I've taken a look to the code and I see that it is a particle that atracts other ones than appears in a random way throught the windows. I´ve modified the code to represent the particles as a point instead of using the fade.png. The particles appears at the beginning and all dissapear quickly. I´ve changed the atraction constant and they dissapear slowly, but they don't move. I vave no idea of why this is happening.
This is the modified code:
import traer.physics.*;
Particle mouse;
Particle[] others;
ParticleSystem physics;
Particle[] others;
ParticleSystem physics;
//PImage img;
void setup()
{
size( 400, 400 );
frameRate( 24 );
cursor( CROSS );
//img = loadImage( "fade.png" );
//imageMode( CORNER );
//tint( 0, 32 );
physics = new ParticleSystem( 0, 0.1 );
mouse = physics.makeParticle();
mouse.makeFixed();
others = new Particle[1000];
for ( int i = 0; i < others.length; i++ )
{
others[i] = physics.makeParticle( 1.0, random( 0, width ), random( 0, height ), 0 );
physics.makeAttraction( mouse, others[i], 5, 50 );
}
}
{
size( 400, 400 );
frameRate( 24 );
cursor( CROSS );
//img = loadImage( "fade.png" );
//imageMode( CORNER );
//tint( 0, 32 );
physics = new ParticleSystem( 0, 0.1 );
mouse = physics.makeParticle();
mouse.makeFixed();
others = new Particle[1000];
for ( int i = 0; i < others.length; i++ )
{
others[i] = physics.makeParticle( 1.0, random( 0, width ), random( 0, height ), 0 );
physics.makeAttraction( mouse, others[i], 5, 50 );
}
}
void draw()
{
mouse.position().set( mouseX, mouseY, 0 );
physics.tick();
{
mouse.position().set( mouseX, mouseY, 0 );
physics.tick();
background(0 );
for ( int i = 0; i < others.length; i++ )
{
Particle p = others[i];
set( int(p.position().x()),int(p.position().y()),100 );
}
}
for ( int i = 0; i < others.length; i++ )
{
Particle p = others[i];
set( int(p.position().x()),int(p.position().y()),100 );
}
}
1