Friday, October 8, 2010

Particles and the iPad: Part II

I haven't given up on particles - and intend to get a system working where the world is composed of small particles that interact with each other.  My latest experiment consists of a simple discrete element method.  The method works perfectly for collisions; however as I try to introduce springs between particles the model starts to explode.

The reason is that the force from the spring is quite big and amplifies the forces from the other particles.  The simple solution would be more time steps; however I believe that there must have a better way to do this.

My next experiment will involve altering the repulsive and spring forces.  First; they will not vary as much based upon distance.  That is, the force will not go to infinity as two particles approach the limit of overlapping.  Similarly, for my springs, the force will appear like a sine-wave.  It will be very strong for a short radius and gracefully diminish over distance, sort of like a magnet.

The former strategy will help reduce the apparent visuals from explosions by preventing particles from exiting a collision with massive force.  However, without the springs this section is perfectly stable; which makes me believe I shouldn't play with it...

The latter will provide a smoother function for springs.  It's more for visual appeal than stability.  For stability, though, I will need to rework the spring algorithms so that they do not exert too much force.

A final note; I might re-introduce pressure calculations a la smoothed particle hydrodynamics.  It will provide more realistic motion for my particles which are currently synthetically confined to the plane.  Actually, first, I'll get them off the plane by adding a bit of random jitter to their initial position.  The shear force should give the effect that I'm looking for...

Anyhow; back to the drawing board...

No comments:

Post a Comment