2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
5 This software is provided 'as-is', without any express or implied warranty.
6 In no event will the authors be held liable for any damages arising from the use of this software.
7 Permission is granted to anyone to use this software for any purpose,
8 including commercial applications, and to alter it and redistribute it freely,
9 subject to the following restrictions:
11 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
12 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
13 3. This notice may not be removed or altered from any source distribution.
16 #ifndef BT_CONTACT_SOLVER_INFO
17 #define BT_CONTACT_SOLVER_INFO
19 #include "LinearMath/btScalar.h"
23 SOLVER_RANDMIZE_ORDER = 1,
24 SOLVER_FRICTION_SEPARATE = 2,
25 SOLVER_USE_WARMSTARTING = 4,
26 SOLVER_USE_2_FRICTION_DIRECTIONS = 16,
27 SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32,
28 SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64,
29 SOLVER_CACHE_FRIENDLY = 128,
31 SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS = 512,
32 SOLVER_ALLOW_ZERO_LENGTH_FRICTION_DIRECTIONS = 1024
35 struct btContactSolverInfoData
40 btScalar m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
43 btScalar m_restitution;
45 btScalar m_maxErrorReduction;
47 btScalar m_erp;//used as Baumgarte factor
48 btScalar m_erp2;//used in Split Impulse
49 btScalar m_globalCfm;//constraint force mixing
51 btScalar m_splitImpulsePenetrationThreshold;
52 btScalar m_splitImpulseTurnErp;
53 btScalar m_linearSlop;
54 btScalar m_warmstartingFactor;
57 int m_restingContactRestitutionThreshold;
58 int m_minimumSolverBatchSize;
59 btScalar m_maxGyroscopicForce;
60 btScalar m_singleAxisRollingFrictionThreshold;
65 struct btContactSolverInfo : public btContactSolverInfoData
70 inline btContactSolverInfo()
72 m_tau = btScalar(0.6);
73 m_damping = btScalar(1.0);
74 m_friction = btScalar(0.3);
75 m_timeStep = btScalar(1.f/60.f);
76 m_restitution = btScalar(0.);
77 m_maxErrorReduction = btScalar(20.);
79 m_erp = btScalar(0.2);
80 m_erp2 = btScalar(0.8);
81 m_globalCfm = btScalar(0.);
83 m_splitImpulse = true;
84 m_splitImpulsePenetrationThreshold = -.04f;
85 m_splitImpulseTurnErp = 0.1f;
86 m_linearSlop = btScalar(0.0);
87 m_warmstartingFactor=btScalar(0.85);
88 //m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD | SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION|SOLVER_USE_2_FRICTION_DIRECTIONS|SOLVER_ENABLE_FRICTION_DIRECTION_CACHING;// | SOLVER_RANDMIZE_ORDER;
89 m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SOLVER_RANDMIZE_ORDER;
90 m_restingContactRestitutionThreshold = 2;//unused as of 2.81
91 m_minimumSolverBatchSize = 128; //try to combine islands until the amount of constraints reaches this limit
92 m_maxGyroscopicForce = 100.f; ///only used to clamp forces for bodies that have their BT_ENABLE_GYROPSCOPIC_FORCE flag set (using btRigidBody::setFlag)
93 m_singleAxisRollingFrictionThreshold = 1e30f;///if the velocity is above this threshold, it will use a single constraint row (axis), otherwise 3 rows.
97 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
98 struct btContactSolverInfoDoubleData
101 double m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
104 double m_restitution;
105 double m_maxErrorReduction;
107 double m_erp;//used as Baumgarte factor
108 double m_erp2;//used in Split Impulse
109 double m_globalCfm;//constraint force mixing
110 double m_splitImpulsePenetrationThreshold;
111 double m_splitImpulseTurnErp;
113 double m_warmstartingFactor;
114 double m_maxGyroscopicForce;
115 double m_singleAxisRollingFrictionThreshold;
119 int m_restingContactRestitutionThreshold;
120 int m_minimumSolverBatchSize;
125 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
126 struct btContactSolverInfoFloatData
129 float m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
134 float m_maxErrorReduction;
136 float m_erp;//used as Baumgarte factor
138 float m_erp2;//used in Split Impulse
139 float m_globalCfm;//constraint force mixing
140 float m_splitImpulsePenetrationThreshold;
141 float m_splitImpulseTurnErp;
144 float m_warmstartingFactor;
145 float m_maxGyroscopicForce;
146 float m_singleAxisRollingFrictionThreshold;
150 int m_restingContactRestitutionThreshold;
151 int m_minimumSolverBatchSize;
159 #endif //BT_CONTACT_SOLVER_INFO