## SoftBody behaviour with time increment and iteration number

Posts: 71
Joined: Mon Dec 02, 2013 4:13 pm

### SoftBody behaviour with time increment and iteration number

Hi all,

I'm simulating a rope (softbody) as an spring in an engineering project.
However, I found out that soft body (not even ropes, but patches) behave strangely with time step and iteration!

Ok, I understand that the behaviour should change when iteration number is changed, but it must converge to an stable behaviour.
When I change the iteration number from 10, 50, 100, 200, 400, 1000, each case have a unique behaviour which I cannot find any clue of "Convergence" of soft body behaviour!
The larger the iteration number is, the stiffer the soft body become. Is there any bug through the mathematical sweeping process of softbody?

And its the case with time increment as well.

Have you faced the same thing?

RJ

DannyChapman
Posts: 85
Joined: Sun Jan 07, 2007 4:29 pm
Location: Oxford, England
Contact:

### Re: SoftBody behaviour with time increment and iteration num

However, I found out that soft body (not even ropes, but patches) behave strangely with time step and iteration!
Yes, I get this - my simulation timestep can vary a lot, and that causes problems because the accuracy of the rope simulation varies. I don't mind a bit of stretching (actually for me it's quite good), but I need to have some way to make it always the same, regardless of the timestep.

The two uses I have are for model aircraft: aerotow (https://youtu.be/Rkr4QNzjezk) and control-line simulation (https://youtu.be/KXPQI2wK_BU)

My "solution" was to adjust the number of soft-body solver iterations based on the timestep:

Code: Select all

``````  float subSteps = ClampToRange<float>((float) PicaSim::GetInstance().GetSettings().mOptions.mFrameworkSettings.mPhysicsSubsteps, 4.0f, 12.0f);
float p = (subSteps - 4.0f) / 4.0f;
float fiters = 16.0f / powf(2, p);
int iters = ClampToRange((int) (fiters + 0.5f), 4, 16);
iters = 2 * (iters / 2); // make it even

mTowRopeSoftBody->m_cfg.piterations = iters; // Needs to be even to avoid an offset?
``````
My game typically runs at 60Hz, but the user is able to adjust the number of substeps (e.g. subStep = 5 means the timestep is 1/(5*60)). I found the code heuristic adaption (hack) works pretty well for substeps in the range 4-12 - for example in the control-line simulation, the lines stretch by about 10%, whatever the subStep value. Without the hack they would stretch 10% in the subStep=4 case, but only something like 2% in the subStep=12 case.

I suspect this is more ad hoc than what you are looking for... if you want precise/accurate behaviour, the softbody implementation in Bullet is probably not good enough (correct me if I'm wrong). Having said that, it should converge onto a more "correct" solution by increasing iterations and/or decreasing the timestep. My experience is that reducing the timestep by X is more effective than increasing the number of iterations by X.

Posts: 71
Joined: Mon Dec 02, 2013 4:13 pm

### Re: SoftBody behaviour with time increment and iteration num

With such annoying things of softbodies, perhaps it is best to use FEM for modelling of deformable bodies for engineering usages.
However, it is not yet implemented in Bullet...