2 Bullet Continuous Collision Detection and Physics Library
3 Copyright (c) 2003-2006 Erwin Coumans https://bulletphysics.org
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 B3_CONTACT_SOLVER_INFO
17 #define B3_CONTACT_SOLVER_INFO
19 #include "Bullet3Common/b3Scalar.h"
23 B3_SOLVER_RANDMIZE_ORDER = 1,
24 B3_SOLVER_FRICTION_SEPARATE = 2,
25 B3_SOLVER_USE_WARMSTARTING = 4,
26 B3_SOLVER_USE_2_FRICTION_DIRECTIONS = 16,
27 B3_SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32,
28 B3_SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64,
29 B3_SOLVER_CACHE_FRIENDLY = 128,
31 B3_SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS = 512,
32 B3_SOLVER_ALLOW_ZERO_LENGTH_FRICTION_DIRECTIONS = 1024
35 struct b3ContactSolverInfoData
38 b3Scalar m_damping; //global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
41 b3Scalar m_restitution;
43 b3Scalar m_maxErrorReduction;
45 b3Scalar m_erp; //used as Baumgarte factor
46 b3Scalar m_erp2; //used in Split Impulse
47 b3Scalar m_globalCfm; //constraint force mixing
49 b3Scalar m_splitImpulsePenetrationThreshold;
50 b3Scalar m_splitImpulseTurnErp;
51 b3Scalar m_linearSlop;
52 b3Scalar m_warmstartingFactor;
55 int m_restingContactRestitutionThreshold;
56 int m_minimumSolverBatchSize;
57 b3Scalar m_maxGyroscopicForce;
58 b3Scalar m_singleAxisRollingFrictionThreshold;
61 struct b3ContactSolverInfo : public b3ContactSolverInfoData
63 inline b3ContactSolverInfo()
65 m_tau = b3Scalar(0.6);
66 m_damping = b3Scalar(1.0);
67 m_friction = b3Scalar(0.3);
68 m_timeStep = b3Scalar(1.f / 60.f);
69 m_restitution = b3Scalar(0.);
70 m_maxErrorReduction = b3Scalar(20.);
72 m_erp = b3Scalar(0.2);
73 m_erp2 = b3Scalar(0.8);
74 m_globalCfm = b3Scalar(0.);
76 m_splitImpulse = true;
77 m_splitImpulsePenetrationThreshold = -.04f;
78 m_splitImpulseTurnErp = 0.1f;
79 m_linearSlop = b3Scalar(0.0);
80 m_warmstartingFactor = b3Scalar(0.85);
81 //m_solverMode = B3_SOLVER_USE_WARMSTARTING | B3_SOLVER_SIMD | B3_SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION|B3_SOLVER_USE_2_FRICTION_DIRECTIONS|B3_SOLVER_ENABLE_FRICTION_DIRECTION_CACHING;// | B3_SOLVER_RANDMIZE_ORDER;
82 m_solverMode = B3_SOLVER_USE_WARMSTARTING | B3_SOLVER_SIMD; // | B3_SOLVER_RANDMIZE_ORDER;
83 m_restingContactRestitutionThreshold = 2; //unused as of 2.81
84 m_minimumSolverBatchSize = 128; //try to combine islands until the amount of constraints reaches this limit
85 m_maxGyroscopicForce = 100.f; ///only used to clamp forces for bodies that have their B3_ENABLE_GYROPSCOPIC_FORCE flag set (using b3RigidBody::setFlag)
86 m_singleAxisRollingFrictionThreshold = 1e30f; ///if the velocity is above this threshold, it will use a single constraint row (axis), otherwise 3 rows.
90 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
91 struct b3ContactSolverInfoDoubleData
94 double m_damping; //global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
98 double m_maxErrorReduction;
100 double m_erp; //used as Baumgarte factor
101 double m_erp2; //used in Split Impulse
102 double m_globalCfm; //constraint force mixing
103 double m_splitImpulsePenetrationThreshold;
104 double m_splitImpulseTurnErp;
106 double m_warmstartingFactor;
107 double m_maxGyroscopicForce;
108 double m_singleAxisRollingFrictionThreshold;
112 int m_restingContactRestitutionThreshold;
113 int m_minimumSolverBatchSize;
117 ///do not change those serialization structures, it requires an updated sBulletDNAstr/sBulletDNAstr64
118 struct b3ContactSolverInfoFloatData
121 float m_damping; //global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'.
126 float m_maxErrorReduction;
128 float m_erp; //used as Baumgarte factor
130 float m_erp2; //used in Split Impulse
131 float m_globalCfm; //constraint force mixing
132 float m_splitImpulsePenetrationThreshold;
133 float m_splitImpulseTurnErp;
136 float m_warmstartingFactor;
137 float m_maxGyroscopicForce;
138 float m_singleAxisRollingFrictionThreshold;
142 int m_restingContactRestitutionThreshold;
143 int m_minimumSolverBatchSize;
149 #endif //B3_CONTACT_SOLVER_INFO