   Unwanted Oscillation in Spring Particle System
  I followed a tutorial on implementing a particle system with springs in order to model a rope (http://local.wasp.uwa.edu.au/~pbourke/miscellaneous/particle/). It works great, except that once the rope is in a resting position it starts to oscillate, like so:http://i40.tinypic.com/15mg3nr.pngI've messed around with various constants to no avail. I have a feeling that it could be due to my use of Euler integration, but I haven't been able to get RK4 working.Has anyone else encountered (and fixed) a problem like this?   
  I've messed a lot about with this sort of thing. Don't *ever* use the Euler integration algorithm, simple as that.Don't do this (Euler 1st order):a = f/mx += v*dtv += a*dtInstead you could do like this (Symplectic Euler 1st order):a = f/mv += a*dtx += v*dtOr this, which is better (Leapfrog 2nd order):a = f/mv += 0.5*a*dtx += v*dtv += 0.5*a*dtOr this, which is even better (Velocity Verlet 2nd order):a = f/mv += 0.5*a*dtx += v*dt + 0.5*a*dt*dtv += 0.5*a*dt(assuming x = position, v = velocity, a = acceleration, f = force, m = mass)Just ask if you're still having problems.Cheers,Mike   ;  My experience with RK4 and spring interactions in particle systems is that your timestep has to be sufficiently small to benefit from the RK4 integration. If the spring constant is large then RK4 behaves a bit like euler integration, only in the first force computation there is a contact and the other 3 don't add anything. Note, I don't have a lot of experience with ropes so the situation could be different there then for 'loose' particle systems. I also have good experiences with velocity verlet.   ;Quote:Original post by AiroMy experience with RK4 and spring interactions in particle systems is that your timestep has to be sufficiently small to benefit from the RK4 integration. If the spring constant is large then RK4 behaves a bit like euler integration, only in the first force computation there is a contact and the other 3 don't add anything. Note, I don't have a lot of experience with ropes so the situation could be different there then for 'loose' particle systems. I also have good experiences with velocity verlet.I'd pretty much agree on that. The RK4 algorithm seems to preserve energy much better than most other algorithms, but it is not symplectic, which means that in the long run it looses energy compared to f.inst. velocity verlet, which is my favourite algorithm. Besides that, VV is also more stable than RK4, which in this case means that you can use higher Ks and Kd values and get "stiffer" spring behaviour without blowing up the simulation :-)Cheers,Mike ;  Thanks! I'm using the velocity verlet algorithm you posted and it looks fantastic now. I'll take your advice and not use RK4, though I still wish I could figure out how it works. Cheers guys.   