00001 /* 00002 Bullet Continuous Collision Detection and Physics Library 00003 Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ 00004 00005 This software is provided 'as-is', without any express or implied warranty. 00006 In no event will the authors be held liable for any damages arising from the use of this software. 00007 Permission is granted to anyone to use this software for any purpose, 00008 including commercial applications, and to alter it and redistribute it freely, 00009 subject to the following restrictions: 00010 00011 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. 00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 00013 3. This notice may not be removed or altered from any source distribution. 00014 */ 00015 00016 #ifndef BT_CONTACT_SOLVER_INFO 00017 #define BT_CONTACT_SOLVER_INFO 00018 00019 #include "LinearMath/btScalar.h" 00020 00021 enum btSolverMode 00022 { 00023 SOLVER_RANDMIZE_ORDER = 1, 00024 SOLVER_FRICTION_SEPARATE = 2, 00025 SOLVER_USE_WARMSTARTING = 4, 00026 SOLVER_USE_2_FRICTION_DIRECTIONS = 16, 00027 SOLVER_ENABLE_FRICTION_DIRECTION_CACHING = 32, 00028 SOLVER_DISABLE_VELOCITY_DEPENDENT_FRICTION_DIRECTION = 64, 00029 SOLVER_CACHE_FRIENDLY = 128, 00030 SOLVER_SIMD = 256, 00031 SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS = 512, 00032 SOLVER_ALLOW_ZERO_LENGTH_FRICTION_DIRECTIONS = 1024 00033 }; 00034 00035 struct btContactSolverInfoData 00036 { 00037 00038 00039 btScalar m_tau; 00040 btScalar m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'. 00041 btScalar m_friction; 00042 btScalar m_timeStep; 00043 btScalar m_restitution; 00044 int m_numIterations; 00045 btScalar m_maxErrorReduction; 00046 btScalar m_sor; 00047 btScalar m_erp;//used as Baumgarte factor 00048 btScalar m_erp2;//used in Split Impulse 00049 btScalar m_globalCfm;//constraint force mixing 00050 int m_splitImpulse; 00051 btScalar m_splitImpulsePenetrationThreshold; 00052 btScalar m_splitImpulseTurnErp; 00053 btScalar m_linearSlop; 00054 btScalar m_warmstartingFactor; 00055 00056 int m_solverMode; 00057 int m_restingContactRestitutionThreshold; 00058 int m_minimumSolverBatchSize; 00059 btScalar m_maxGyroscopicForce; 00060 btScalar m_singleAxisRollingFrictionThreshold; 00061 00062 00063 }; 00064 00065 struct btContactSolverInfo : public btContactSolverInfoData 00066 { 00067 00068 00069 00070 inline btContactSolverInfo() 00071 { 00072 m_tau = btScalar(0.6); 00073 m_damping = btScalar(1.0); 00074 m_friction = btScalar(0.3); 00075 m_timeStep = btScalar(1.f/60.f); 00076 m_restitution = btScalar(0.); 00077 m_maxErrorReduction = btScalar(20.); 00078 m_numIterations = 10; 00079 m_erp = btScalar(0.2); 00080 m_erp2 = btScalar(0.8); 00081 m_globalCfm = btScalar(0.); 00082 m_sor = btScalar(1.); 00083 m_splitImpulse = true; 00084 m_splitImpulsePenetrationThreshold = -.04f; 00085 m_splitImpulseTurnErp = 0.1f; 00086 m_linearSlop = btScalar(0.0); 00087 m_warmstartingFactor=btScalar(0.85); 00088 //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; 00089 m_solverMode = SOLVER_USE_WARMSTARTING | SOLVER_SIMD;// | SOLVER_RANDMIZE_ORDER; 00090 m_restingContactRestitutionThreshold = 2;//unused as of 2.81 00091 m_minimumSolverBatchSize = 128; //try to combine islands until the amount of constraints reaches this limit 00092 m_maxGyroscopicForce = 100.f; 00093 m_singleAxisRollingFrictionThreshold = 1e30f; 00094 } 00095 }; 00096 00098 struct btContactSolverInfoDoubleData 00099 { 00100 double m_tau; 00101 double m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'. 00102 double m_friction; 00103 double m_timeStep; 00104 double m_restitution; 00105 double m_maxErrorReduction; 00106 double m_sor; 00107 double m_erp;//used as Baumgarte factor 00108 double m_erp2;//used in Split Impulse 00109 double m_globalCfm;//constraint force mixing 00110 double m_splitImpulsePenetrationThreshold; 00111 double m_splitImpulseTurnErp; 00112 double m_linearSlop; 00113 double m_warmstartingFactor; 00114 double m_maxGyroscopicForce; 00115 double m_singleAxisRollingFrictionThreshold; 00116 00117 int m_numIterations; 00118 int m_solverMode; 00119 int m_restingContactRestitutionThreshold; 00120 int m_minimumSolverBatchSize; 00121 int m_splitImpulse; 00122 char m_padding[4]; 00123 00124 }; 00126 struct btContactSolverInfoFloatData 00127 { 00128 float m_tau; 00129 float m_damping;//global non-contact constraint damping, can be locally overridden by constraints during 'getInfo2'. 00130 float m_friction; 00131 float m_timeStep; 00132 00133 float m_restitution; 00134 float m_maxErrorReduction; 00135 float m_sor; 00136 float m_erp;//used as Baumgarte factor 00137 00138 float m_erp2;//used in Split Impulse 00139 float m_globalCfm;//constraint force mixing 00140 float m_splitImpulsePenetrationThreshold; 00141 float m_splitImpulseTurnErp; 00142 00143 float m_linearSlop; 00144 float m_warmstartingFactor; 00145 float m_maxGyroscopicForce; 00146 float m_singleAxisRollingFrictionThreshold; 00147 00148 int m_numIterations; 00149 int m_solverMode; 00150 int m_restingContactRestitutionThreshold; 00151 int m_minimumSolverBatchSize; 00152 00153 int m_splitImpulse; 00154 char m_padding[4]; 00155 }; 00156 00157 00158 00159 #endif //BT_CONTACT_SOLVER_INFO