top of page

Spring Mass Damping!

These are a few examples of the things you can do with Spring Mass Damping systems.  They can be used to simulate things such as cloth or jello.  Below is a fairly basic example demonstrating just the forces from a springs and dampers on a cube using two integration methods.

This system will go through a set of vertices on a polygon and use each edge as a "strut." The acceleration being applied come from 3 main forces.  The stiffness of a spring will determine how difficult it is to compress or stretch the spring and how much it will want to get back to it's original shape.  The damping force works by exerting a force opposing the velocity of the mass.  In each spring the position of the mass is each vertex point.  The rest length must also be known to compute the forces.

Implemented as a cloth solver

The examples shown in the next video are all applied to a plane.  I have implemented multiple versions which show various scenarios from over and under damped springs which are unstable to extremely stiff strings which restrict overall movement.  

   

The red vertices color shift is determined by change in velocity.  The brighter the red the greater changed in velocity.  The edge color shows how much of a stretch is occurring.  The brightest blue color means it has hit has stretched to double it's rest length or further.

Something important that goes into a system like this is the integration scheme.  Euler is not very stable for this form of simulation. Runge-Kutta 4th Order Integration is a far more stable method.  This method allows for use of the same size time step but drastically increases accuracy.  The example above shows both what happens after only a few seconds of Euler integration with a time step of 0.05 compared to a 4th Order Runge-Kutta integration using the same step size.  In the code example above "tsr" is the variable for the current time step.

bottom of page