Contact solver parameters explained

ProfessionalUser
Posts: 14
Joined: Fri Oct 14, 2011 12:10 am

Contact solver parameters explained

Post by ProfessionalUser »

Hello,

I'm trying to understand the various contact solver parameters. What does each parameter do exactly?

Thanks,
Chris

btScalar m_tau;
btScalar m_damping; //global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
btScalar m_friction;
btScalar m_timeStep;
btScalar m_restitution;
int m_numIterations;
btScalar m_maxErrorReduction;
btScalar m_sor;
btScalar m_erp; //used as Baumgarte factor
btScalar m_erp2; //used in Split Impulse
btScalar m_globalCfm; //constraint force mixing
int m_splitImpulse;
btScalar m_splitImpulsePenetrationThreshold;
btScalar m_linearSlop;
btScalar m_warmstartingFactor;

int m_solverMode;
int m_restingContactRestitutionThreshold;
int m_minimumSolverBatchSize;
User avatar
Yann
Posts: 52
Joined: Wed Sep 28, 2011 8:36 am
Location: France

Re: Contact solver parameters explained

Post by Yann »

I already explained the erp and cfm parameters
in this post : http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=6792
and this post: http://bulletphysics.org/Bullet/phpBB3/ ... f=9&t=7533

But in short:
If CFM is set to zero, the constraint will be hard.
If CFM is set to a positive value, it will be possible to violate the constraint by "pushing on it"
(for example, for contact constraints by forcing the two contacting objects together).
In other words the constraint will be soft, and the softness will increase as CFM increases.
What is actually happening here is that the constraint is allowed to be violated by an amount proportional
to CFM times the restoring force that is needed to enforce the constraint.
Note that setting CFM to a negative value can have undesirable bad effects, such as instability. Don't do it.

The ERP specifies what proportion of the joint error will be fixed during the next simulation step.
If ERP=0 then no correcting force is applied and the bodies will eventually drift apart as the simulation proceeds.
If ERP=1 then the simulation will attempt to fix all joint error during the next time step.
However, setting ERP=1 is not recommended, as the joint error will not be completely fixed due to various internal approximations.
A value of ERP=0.1 to 0.8 is recommended (0.2 is the default).

As for other parameters, restitution would be the amount of energy that is used when a body bounce on another one (if set to 1., then the body will bounce as high as it came from).
Friction would be the amount of energy that is 'lost' when a body slide on another (if set to 1., a body would eventually never stop moving on another body).