Closed aunruh closed 11 years ago
Ok it works! I just added my particles and springs directly to the VerletPhysics object. Instead of making a ParticleString object. :)
This unit test for the constructor passes. The array of particles, and the created springs end up in the physics object correctly:
Are you using this within Processing.js with the Processing/Java syntax? If so, maybe you are passing it a java collection? toxiclibs.js always wants a normal Array.
Oh, yeah that must have been the problem. Didn't use the proper array. Thanks!
Hi! When I initialize a ParticleString2D this way:
ParticleString2D(VerletPhysics2D physics, java.util.List<VerletParticle2D> plist, float strength)
Then
println(physics.particles.length);
orprintln(physics.springs.length);
returns 0. Is the constructor not yet implemented or am I doing something wrong?The other way works perfectly:
ParticleString2D(VerletPhysics2D physics, toxi.geom.Vec2D pos, toxi.geom.Vec2D step, int num, float mass, float strength)
Why do I want to use this constructor? The particles in
java.util.List<VerletParticle2D> plist
have specific coordinates. This way i'm not constricted to usingtoxi.geom.Vec2D step
andtoxi.geom.Vec2D pos
for the positioning of the particles.Cheers