   Ball and line physics problem
  I'm trying to simulate a circle bouncing onto a line (in 2d), like a ball bouncing onto a trampoline.  The line needs to be elastic so that it stretches if ball comes to rest on it.  Ideally I'd like to be able to throw as many balls into the simulation as possible.  Does anyone know of any source code that would help with this, or (free or open source) physics engines that could handle it?   
  I can't provide any source code, and I don't know if the psysics engines out there can provide tools for simulating such a situation, but you could try simulating it on your own using particles for the 2d line. You can iterate through all particles and apply 2 forces to each one according to its distance from its two neighboring particles (on that direction). The two particles at the edges should be fixed. Then just try to find collisions of these particles with the spheres.I suppose it should work if the number of particles is high enough.   ;Quote:Original post by someusernameI can't provide any source code, and I don't know if the psysics engines out there can provide tools for simulating such a situation, but you could try simulating it on your own using particles for the 2d line. You can iterate through all particles and apply 2 forces to each one according to its distance from its two neighboring particles (on that direction). The two particles at the edges should be fixed. Then just try to find collisions of these particles with the spheres.I suppose it should work if the number of particles is high enough.In other words, model the line as a bunch of particles connected by springs.   ;  A mass spring system will work fine for this.  The only tricky bit is volume preservation.  If you think of a circle of points connected by springs, there is nothing that would keep it from turning inside out or collapsing.  No need to reinvent the wheel (punny eh?) though.  Model your circle as a wheel with the points on the rim connected by springs.  Add a center point and spokes radiating out to the points on the circle also connected with springs.  The spring constants will control the squishiness.  Or even more fun might be, make a "rigid hub" in the middle that is represented by a point, radius, and rotation angle.  Connect the spokes to points around the hub.  Then to drive the ball around, just rotate the hub and it will all work like a really flat tire.My series of articles on soft body dynamics will give you all the code and math you will need.  Your case being 2D is even easier so you can simplify it.Starting with this one and go forward to the bit on Friction.http://www.darwin3d.com/gdm1999.htm#gdm0399Good luck with it, sounds fun.   