Bullet Collision Detection & Physics Library: btContactSolverInfo.h Source File

Bullet Collision Detection & Physics Library

btContactSolverInfo.h
Go to the documentation of this file.
1 /*
2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/
4
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:
10
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.
14 */
15
16 #ifndef BT_CONTACT_SOLVER_INFO
17 #define BT_CONTACT_SOLVER_INFO
18
19 #include "LinearMath/btScalar.h"
20
21 enum btSolverMode
22 {
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,
30 SOLVER_SIMD = 256,
31 SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS = 512,
32 SOLVER_ALLOW_ZERO_LENGTH_FRICTION_DIRECTIONS = 1024
33 };
34
35 struct btContactSolverInfoData
36 {
37
38
39 btScalar m_tau;
40 btScalar m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
41 btScalar m_friction;
42 btScalar m_timeStep;
43 btScalar m_restitution;
44 int m_numIterations;
45 btScalar m_maxErrorReduction;
46 btScalar m_sor;
47 btScalar m_erp;//used as Baumgarte factor
48 btScalar m_erp2;//used in Split Impulse
49 btScalar m_globalCfm;//constraint force mixing
50 int m_splitImpulse;
51 btScalar m_splitImpulsePenetrationThreshold;
52 btScalar m_splitImpulseTurnErp;
53 btScalar m_linearSlop;
54 btScalar m_warmstartingFactor;
55
56 int m_solverMode;
57 int m_restingContactRestitutionThreshold;
58 int m_minimumSolverBatchSize;
59 btScalar m_maxGyroscopicForce;
60 btScalar m_singleAxisRollingFrictionThreshold;
61
62
63 };
64
65 struct btContactSolverInfo : public btContactSolverInfoData
66 {
67
68
69
70 inline btContactSolverInfo()
71 {
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.);
78 m_numIterations = 10;
79 m_erp = btScalar(0.2);
80 m_erp2 = btScalar(0.2);
81 m_globalCfm = btScalar(0.);
82 m_sor = btScalar(1.);
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;
93 m_singleAxisRollingFrictionThreshold = 1e30f;
94 }
95 };
96
98 struct btContactSolverInfoDoubleData
99 {
100 double m_tau;
101 double m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
102 double m_friction;
103 double m_timeStep;
104 double m_restitution;
105 double m_maxErrorReduction;
106 double m_sor;
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;
112 double m_linearSlop;
113 double m_warmstartingFactor;
114 double m_maxGyroscopicForce;
115 double m_singleAxisRollingFrictionThreshold;
116
117 int m_numIterations;
118 int m_solverMode;
119 int m_restingContactRestitutionThreshold;
120 int m_minimumSolverBatchSize;
121 int m_splitImpulse;
122 char m_padding[4];
123
124 };
126 struct btContactSolverInfoFloatData
127 {
128 float m_tau;
129 float m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
130 float m_friction;
131 float m_timeStep;
132
133 float m_restitution;
134 float m_maxErrorReduction;
135 float m_sor;
136 float m_erp;//used as Baumgarte factor
137
138 float m_erp2;//used in Split Impulse
139 float m_globalCfm;//constraint force mixing
140 float m_splitImpulsePenetrationThreshold;
141 float m_splitImpulseTurnErp;
142
143 float m_linearSlop;
144 float m_warmstartingFactor;
145 float m_maxGyroscopicForce;
146 float m_singleAxisRollingFrictionThreshold;
147
148 int m_numIterations;
149 int m_solverMode;
150 int m_restingContactRestitutionThreshold;
151 int m_minimumSolverBatchSize;
152
153 int m_splitImpulse;
154 char m_padding[4];
155 };
156
157
158
159 #endif //BT_CONTACT_SOLVER_INFO
btContactSolverInfoDoubleData::m_timeStep
double m_timeStep
Definition: btContactSolverInfo.h:103
btContactSolverInfoData::m_splitImpulseTurnErp
btScalar m_splitImpulseTurnErp
Definition: btContactSolverInfo.h:52
btContactSolverInfoData::m_friction
btScalar m_friction
Definition: btContactSolverInfo.h:41
btContactSolverInfoData::m_tau
btScalar m_tau
Definition: btContactSolverInfo.h:39
btContactSolverInfoData::m_erp
btScalar m_erp
Definition: btContactSolverInfo.h:47
btContactSolverInfoDoubleData::m_damping
double m_damping
Definition: btContactSolverInfo.h:101
btContactSolverInfoFloatData::m_restingContactRestitutionThreshold
int m_restingContactRestitutionThreshold
Definition: btContactSolverInfo.h:150
btContactSolverInfoDoubleData::m_sor
double m_sor
Definition: btContactSolverInfo.h:106
btContactSolverInfoDoubleData::m_warmstartingFactor
double m_warmstartingFactor
Definition: btContactSolverInfo.h:113
btContactSolverInfoDoubleData::m_maxErrorReduction
double m_maxErrorReduction
Definition: btContactSolverInfo.h:105
SOLVER_FRICTION_SEPARATE
Definition: btContactSolverInfo.h:24
btContactSolverInfoFloatData::m_restitution
float m_restitution
Definition: btContactSolverInfo.h:133
SOLVER_ALLOW_ZERO_LENGTH_FRICTION_DIRECTIONS
Definition: btContactSolverInfo.h:32
btContactSolverInfoDoubleData::m_minimumSolverBatchSize
int m_minimumSolverBatchSize
Definition: btContactSolverInfo.h:120
btContactSolverInfoDoubleData::m_numIterations
int m_numIterations
Definition: btContactSolverInfo.h:117
btContactSolverInfoData::m_splitImpulse
int m_splitImpulse
Definition: btContactSolverInfo.h:50
btContactSolverInfoFloatData::m_minimumSolverBatchSize
int m_minimumSolverBatchSize
Definition: btContactSolverInfo.h:151
SOLVER_USE_WARMSTARTING
Definition: btContactSolverInfo.h:25
btContactSolverInfoDoubleData::m_maxGyroscopicForce
double m_maxGyroscopicForce
Definition: btContactSolverInfo.h:114
btSolverMode
btSolverMode
Definition: btContactSolverInfo.h:21
btContactSolverInfoData::m_singleAxisRollingFrictionThreshold
btScalar m_singleAxisRollingFrictionThreshold
Definition: btContactSolverInfo.h:60
btContactSolverInfoDoubleData::m_splitImpulse
int m_splitImpulse
Definition: btContactSolverInfo.h:121
btContactSolverInfoDoubleData::m_splitImpulseTurnErp
double m_splitImpulseTurnErp
Definition: btContactSolverInfo.h:111
btContactSolverInfoFloatData::m_linearSlop
float m_linearSlop
Definition: btContactSolverInfo.h:143
SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION
Definition: btContactSolverInfo.h:28
btContactSolverInfoFloatData::m_erp
float m_erp
Definition: btContactSolverInfo.h:136
btContactSolverInfoData::m_globalCfm
btScalar m_globalCfm
Definition: btContactSolverInfo.h:49
btContactSolverInfoDoubleData::m_tau
double m_tau
Definition: btContactSolverInfo.h:100
btContactSolverInfoFloatData::m_maxGyroscopicForce
float m_maxGyroscopicForce
Definition: btContactSolverInfo.h:145
btContactSolverInfoFloatData::m_splitImpulseTurnErp
float m_splitImpulseTurnErp
Definition: btContactSolverInfo.h:141
btContactSolverInfoData::m_damping
btScalar m_damping
Definition: btContactSolverInfo.h:40
btContactSolverInfoFloatData::m_solverMode
int m_solverMode
Definition: btContactSolverInfo.h:149
SOLVER_CACHE_FRIENDLY
Definition: btContactSolverInfo.h:29
btContactSolverInfoFloatData::m_maxErrorReduction
float m_maxErrorReduction
Definition: btContactSolverInfo.h:134
SOLVER_RANDMIZE_ORDER
Definition: btContactSolverInfo.h:23
btContactSolverInfoFloatData::m_globalCfm
float m_globalCfm
Definition: btContactSolverInfo.h:139
btContactSolverInfoDoubleData::m_globalCfm
double m_globalCfm
Definition: btContactSolverInfo.h:109
btContactSolverInfoData::m_restitution
btScalar m_restitution
Definition: btContactSolverInfo.h:43
btContactSolverInfoDoubleData::m_solverMode
int m_solverMode
Definition: btContactSolverInfo.h:118
btContactSolverInfoFloatData::m_tau
float m_tau
Definition: btContactSolverInfo.h:128
btContactSolverInfoDoubleData::m_friction
double m_friction
Definition: btContactSolverInfo.h:102
SOLVER_USE_2_FRICTION_DIRECTIONS
Definition: btContactSolverInfo.h:26
btContactSolverInfoFloatData::m_damping
float m_damping
Definition: btContactSolverInfo.h:129
btContactSolverInfoData::m_erp2
btScalar m_erp2
Definition: btContactSolverInfo.h:48
btContactSolverInfoData::m_numIterations
int m_numIterations
Definition: btContactSolverInfo.h:44
btContactSolverInfoFloatData::m_erp2
float m_erp2
Definition: btContactSolverInfo.h:138
SOLVER_SIMD
Definition: btContactSolverInfo.h:30
btContactSolverInfoFloatData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btContactSolverInfo.h:126
SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS
Definition: btContactSolverInfo.h:31
btContactSolverInfoFloatData::m_numIterations
int m_numIterations
Definition: btContactSolverInfo.h:148
btContactSolverInfoDoubleData::m_erp2
double m_erp2
Definition: btContactSolverInfo.h:108
btContactSolverInfoFloatData::m_singleAxisRollingFrictionThreshold
float m_singleAxisRollingFrictionThreshold
Definition: btContactSolverInfo.h:146
btContactSolverInfoDoubleData::m_linearSlop
double m_linearSlop
Definition: btContactSolverInfo.h:112
btContactSolverInfo::btContactSolverInfo
btContactSolverInfo()
Definition: btContactSolverInfo.h:70
btContactSolverInfo
Definition: btContactSolverInfo.h:65
btContactSolverInfoFloatData::m_timeStep
float m_timeStep
Definition: btContactSolverInfo.h:131
btContactSolverInfoData::m_minimumSolverBatchSize
int m_minimumSolverBatchSize
Definition: btContactSolverInfo.h:58
btContactSolverInfoFloatData::m_sor
float m_sor
Definition: btContactSolverInfo.h:135
btContactSolverInfoFloatData::m_splitImpulsePenetrationThreshold
float m_splitImpulsePenetrationThreshold
Definition: btContactSolverInfo.h:140
btContactSolverInfoData::m_restingContactRestitutionThreshold
int m_restingContactRestitutionThreshold
Definition: btContactSolverInfo.h:57
btContactSolverInfoDoubleData::m_restitution
double m_restitution
Definition: btContactSolverInfo.h:104
btContactSolverInfoData::m_splitImpulsePenetrationThreshold
btScalar m_splitImpulsePenetrationThreshold
Definition: btContactSolverInfo.h:51
btContactSolverInfoDoubleData::m_singleAxisRollingFrictionThreshold
double m_singleAxisRollingFrictionThreshold
it is only used for &#39;explicit&#39; version of gyroscopic force
Definition: btContactSolverInfo.h:115
btContactSolverInfoData::m_maxErrorReduction
btScalar m_maxErrorReduction
Definition: btContactSolverInfo.h:45
btContactSolverInfoDoubleData::m_splitImpulsePenetrationThreshold
double m_splitImpulsePenetrationThreshold
Definition: btContactSolverInfo.h:110
btContactSolverInfoFloatData::m_warmstartingFactor
float m_warmstartingFactor
Definition: btContactSolverInfo.h:144
btContactSolverInfoData::m_linearSlop
btScalar m_linearSlop
Definition: btContactSolverInfo.h:53
btContactSolverInfoFloatData::m_splitImpulse
int m_splitImpulse
Definition: btContactSolverInfo.h:153
SOLVER_ENABLE_FRICTION_DIRECTION_CACHING
Definition: btContactSolverInfo.h:27
btContactSolverInfoData
Definition: btContactSolverInfo.h:35
btContactSolverInfoData::m_timeStep
btScalar m_timeStep
Definition: btContactSolverInfo.h:42
btContactSolverInfoData::m_maxGyroscopicForce
btScalar m_maxGyroscopicForce
Definition: btContactSolverInfo.h:59
btContactSolverInfoDoubleData::m_restingContactRestitutionThreshold
int m_restingContactRestitutionThreshold
Definition: btContactSolverInfo.h:119
btContactSolverInfoData::m_warmstartingFactor
btScalar m_warmstartingFactor
Definition: btContactSolverInfo.h:54
btContactSolverInfoDoubleData::m_erp
double m_erp
Definition: btContactSolverInfo.h:107
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition: btScalar.h:279
btContactSolverInfoData::m_solverMode
int m_solverMode
Definition: btContactSolverInfo.h:56
btContactSolverInfoDoubleData
do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64 ...
Definition: btContactSolverInfo.h:98
btContactSolverInfoData::m_sor
btScalar m_sor
Definition: btContactSolverInfo.h:46
btContactSolverInfoFloatData::m_friction
float m_friction
Definition: btContactSolverInfo.h:130
btScalar.h