NVIDIAGameWorks / FleX

Other
664 stars 100 forks source link

Disabling Sleep Threshold #17

Open ngartner opened 7 years ago

ngartner commented 7 years ago

Is there a way I can totally disable the parameter Sleep Threshold ? I have tried to put it to FLT_MIN and to 0.0f, but it seems that there the solid still comes to sleep. In my simulation my body oscillates and at some positions where he should not be at equilibrium the body simply stops to move, even if external forces like gravity are applying and should make it fall. This happens when values are close to an unstable equilibrium state and velocity should change from a positive value to a negative value.

Thank you in advance

ngartner commented 7 years ago

Figured out that maybe setting the particles from that particular phase active again at each frame could be a solution but that will be costly. I'll try to implement that.

Edit : This solution didn't work as the rigid body is fixed but the particles remain active.

mmacklin commented 7 years ago

Hi Nicolas, I'm not sure if it is related, but there are some numerical thresholds in the shape matching code for solids that clamp minimum deltas to prevent drift due to inaccuracies. The threshold is on the order of 10^-5 units, so if your body moves more than that per-timestep then it should be OK.

The sleep threshold only applies to individual particles, not to the solid shape as a whole.

Are you maybe using a lot of substeps? That can also cause a loss of precision or trigger the threshold.

Cheers, Miles

ngartner commented 7 years ago

Hello Miles,

This small speedthreshold might be the answer. As I only set Substeps to 2. Maybe increasing the number of Substep is the answer ? I'll send you more details in private.

Cheers, Nicolas