102 #include <emmintrin.h> 104 #define btVecSplat(x, e) _mm_shuffle_ps(x, x, _MM_SHUFFLE(e, e, e, e)) 105 static inline __m128 btSimdDot3(__m128 vec0, __m128 vec1)
107 __m128 result = _mm_mul_ps(vec0, vec1);
108 return _mm_add_ps(btVecSplat(result, 0), _mm_add_ps(btVecSplat(result, 1), btVecSplat(result, 2)));
111 #if defined(BT_ALLOW_SSE4) 115 #define USE_FMA3_INSTEAD_FMA4 1 116 #define USE_SSE4_DOT 1 118 #define SSE4_DP(a, b) _mm_dp_ps(a, b, 0x7f) 119 #define SSE4_DP_FP(a, b) _mm_cvtss_f32(_mm_dp_ps(a, b, 0x7f)) 122 #define DOT_PRODUCT(a, b) SSE4_DP(a, b) 124 #define DOT_PRODUCT(a, b) btSimdDot3(a, b) 128 #if USE_FMA3_INSTEAD_FMA4 130 #define FMADD(a, b, c) _mm_fmadd_ps(a, b, c) 132 #define FMNADD(a, b, c) _mm_fnmadd_ps(a, b, c) 135 #define FMADD(a, b, c) _mm_macc_ps(a, b, c) 137 #define FMNADD(a, b, c) _mm_nmacc_ps(a, b, c) 141 #define FMADD(a, b, c) _mm_add_ps(c, _mm_mul_ps(a, b)) 143 #define FMNADD(a, b, c) _mm_sub_ps(c, _mm_mul_ps(a, b)) 156 deltaImpulse = _mm_sub_ps(deltaImpulse, _mm_mul_ps(deltaVel1Dotn, _mm_set1_ps(c.
m_jacDiagABInv)));
157 deltaImpulse = _mm_sub_ps(deltaImpulse, _mm_mul_ps(deltaVel2Dotn, _mm_set1_ps(c.
m_jacDiagABInv)));
160 resultLowerLess = _mm_cmplt_ps(
sum, lowerLimit1);
161 resultUpperLess = _mm_cmplt_ps(
sum, upperLimit1);
162 __m128 lowMinApplied = _mm_sub_ps(lowerLimit1, cpAppliedImp);
163 deltaImpulse = _mm_or_ps(_mm_and_ps(resultLowerLess, lowMinApplied), _mm_andnot_ps(resultLowerLess, deltaImpulse));
164 c.
m_appliedImpulse = _mm_or_ps(_mm_and_ps(resultLowerLess, lowerLimit1), _mm_andnot_ps(resultLowerLess,
sum));
165 __m128 upperMinApplied = _mm_sub_ps(upperLimit1, cpAppliedImp);
166 deltaImpulse = _mm_or_ps(_mm_and_ps(resultUpperLess, deltaImpulse), _mm_andnot_ps(resultUpperLess, upperMinApplied));
170 __m128 impulseMagnitude = deltaImpulse;
181 #if defined(BT_ALLOW_SSE4) 188 deltaImpulse = FMNADD(deltaVel1Dotn, tmp, deltaImpulse);
189 deltaImpulse = FMNADD(deltaVel2Dotn, tmp, deltaImpulse);
191 const __m128 maskLower = _mm_cmpgt_ps(tmp, lowerLimit);
192 const __m128 maskUpper = _mm_cmpgt_ps(upperLimit, tmp);
193 deltaImpulse = _mm_blendv_ps(_mm_sub_ps(lowerLimit, c.
m_appliedImpulse), _mm_blendv_ps(_mm_sub_ps(upperLimit, c.
m_appliedImpulse), deltaImpulse, maskUpper), maskLower);
194 c.
m_appliedImpulse = _mm_blendv_ps(lowerLimit, _mm_blendv_ps(upperLimit, tmp, maskUpper), maskLower);
202 return gResolveSingleConstraintRowGeneric_sse2(bodyA, bodyB, c);
214 deltaImpulse = _mm_sub_ps(deltaImpulse, _mm_mul_ps(deltaVel1Dotn, _mm_set1_ps(c.
m_jacDiagABInv)));
215 deltaImpulse = _mm_sub_ps(deltaImpulse, _mm_mul_ps(deltaVel2Dotn, _mm_set1_ps(c.
m_jacDiagABInv)));
218 resultLowerLess = _mm_cmplt_ps(
sum, lowerLimit1);
219 resultUpperLess = _mm_cmplt_ps(
sum, upperLimit1);
220 __m128 lowMinApplied = _mm_sub_ps(lowerLimit1, cpAppliedImp);
221 deltaImpulse = _mm_or_ps(_mm_and_ps(resultLowerLess, lowMinApplied), _mm_andnot_ps(resultLowerLess, deltaImpulse));
222 c.
m_appliedImpulse = _mm_or_ps(_mm_and_ps(resultLowerLess, lowerLimit1), _mm_andnot_ps(resultLowerLess,
sum));
225 __m128 impulseMagnitude = deltaImpulse;
242 deltaImpulse = FMNADD(deltaVel1Dotn, tmp, deltaImpulse);
243 deltaImpulse = FMNADD(deltaVel2Dotn, tmp, deltaImpulse);
245 const __m128 mask = _mm_cmpgt_ps(tmp, lowerLimit);
246 deltaImpulse = _mm_blendv_ps(_mm_sub_ps(lowerLimit, c.
m_appliedImpulse), deltaImpulse, mask);
255 return gResolveSingleConstraintRowLowerLimit_sse2(bodyA, bodyB, c);
256 #endif //BT_ALLOW_SSE4 328 deltaImpulse = _mm_sub_ps(deltaImpulse, _mm_mul_ps(deltaVel1Dotn, _mm_set1_ps(c.
m_jacDiagABInv)));
329 deltaImpulse = _mm_sub_ps(deltaImpulse, _mm_mul_ps(deltaVel2Dotn, _mm_set1_ps(c.
m_jacDiagABInv)));
332 resultLowerLess = _mm_cmplt_ps(
sum, lowerLimit1);
333 resultUpperLess = _mm_cmplt_ps(
sum, upperLimit1);
334 __m128 lowMinApplied = _mm_sub_ps(lowerLimit1, cpAppliedImp);
335 deltaImpulse = _mm_or_ps(_mm_and_ps(resultLowerLess, lowMinApplied), _mm_andnot_ps(resultLowerLess, deltaImpulse));
336 c.
m_appliedPushImpulse = _mm_or_ps(_mm_and_ps(resultLowerLess, lowerLimit1), _mm_andnot_ps(resultLowerLess,
sum));
339 __m128 impulseMagnitude = deltaImpulse;
378 #endif //BT_ALLOW_SSE4 400 return gResolveSingleConstraintRowGeneric_sse2;
404 return gResolveSingleConstraintRowLowerLimit_sse2;
409 return gResolveSingleConstraintRowGeneric_sse4_1_fma3;
413 return gResolveSingleConstraintRowLowerLimit_sse4_1_fma3;
415 #endif //BT_ALLOW_SSE4 428 const unsigned long un =
static_cast<unsigned long>(n);
433 if (un <= 0x00010000UL)
436 if (un <= 0x00000100UL)
439 if (un <= 0x00000010UL)
442 if (un <= 0x00000004UL)
445 if (un <= 0x00000002UL)
454 return (
int)(r % un);
495 if (
btFabs(rel_vel) < velocityThreshold)
498 btScalar rest = restitution * -rel_vel;
510 loc_lateral *= friction_scaling;
516 void btSequentialImpulseConstraintSolver::setupFrictionConstraint(
btSolverConstraint& solverConstraint,
const btVector3& normalAxis,
int solverBodyIdA,
int solverBodyIdB,
btManifoldPoint& cp,
const btVector3& rel_pos1,
const btVector3& rel_pos2,
btCollisionObject* colObj0,
btCollisionObject* colObj1,
btScalar relaxation,
const btContactSolverInfo& infoGlobal,
btScalar desiredVelocity,
btScalar cfmSlip)
575 btScalar denom = relaxation / (denom0 + denom1);
584 rel_vel = vel1Dotn + vel2Dotn;
588 btScalar velocityError = desiredVelocity - rel_vel;
597 penetrationImpulse = positionalError * solverConstraint.
m_jacDiagABInv;
600 solverConstraint.
m_rhs = penetrationImpulse + velocityImpulse;
602 solverConstraint.
m_cfm = cfmSlip;
608 btSolverConstraint&
btSequentialImpulseConstraintSolver::addFrictionConstraint(
const btVector3& normalAxis,
int solverBodyIdA,
int solverBodyIdB,
int frictionIndex,
btManifoldPoint& cp,
const btVector3& rel_pos1,
const btVector3& rel_pos2,
btCollisionObject* colObj0,
btCollisionObject* colObj1,
btScalar relaxation,
const btContactSolverInfo& infoGlobal,
btScalar desiredVelocity,
btScalar cfmSlip)
613 colObj0, colObj1, relaxation, infoGlobal, desiredVelocity, cfmSlip);
614 return solverConstraint;
636 solverConstraint.
m_friction = combinedTorsionalFriction;
667 rel_vel = vel1Dotn + vel2Dotn;
673 solverConstraint.
m_rhs = velocityImpulse;
674 solverConstraint.
m_cfm = cfmSlip;
680 btSolverConstraint&
btSequentialImpulseConstraintSolver::addTorsionalFrictionConstraint(
const btVector3& normalAxis,
int solverBodyIdA,
int solverBodyIdB,
int frictionIndex,
btManifoldPoint& cp,
btScalar combinedTorsionalFriction,
const btVector3& rel_pos1,
const btVector3& rel_pos2,
btCollisionObject* colObj0,
btCollisionObject* colObj1,
btScalar relaxation,
btScalar desiredVelocity,
btScalar cfmSlip)
685 colObj0, colObj1, relaxation, desiredVelocity, cfmSlip);
686 return solverConstraint;
692 int solverBodyId = -1;
699 if (solverBodyId < 0)
717 const int INVALID_SOLVER_BODY_ID = -1;
724 if (solverBodyId == INVALID_SOLVER_BODY_ID)
737 if (!isMultiBodyType)
753 #else // BT_THREADSAFE 755 int solverBodyIdA = -1;
787 return solverBodyIdA;
788 #endif // BT_THREADSAFE 793 int solverBodyIdA,
int solverBodyIdB,
812 relaxation = infoGlobal.
m_sor;
850 #ifdef COMPUTE_IMPULSE_DENOM 867 #endif //COMPUTE_IMPULSE_DENOM 869 btScalar denom = relaxation / (denom0 + denom1 + cfm);
940 btScalar rel_vel = vel1Dotn + vel2Dotn;
943 btScalar velocityError = restitution - rel_vel;
949 velocityError -= penetration * invTimeStep;
953 positionalError = -penetration * erp * invTimeStep;
962 solverConstraint.
m_rhs = penetrationImpulse + velocityImpulse;
968 solverConstraint.
m_rhs = velocityImpulse;
978 int solverBodyIdA,
int solverBodyIdB,
1041 int rollingFriction = 1;
1063 rel_pos2 = pos2 - colObj1->getWorldTransform().getOrigin();
1074 setupContactConstraint(solverConstraint, solverBodyIdA, solverBodyIdB, cp, infoGlobal, relaxation, rel_pos1, rel_pos2);
1083 addTorsionalFrictionConstraint(cp.
m_normalWorldOnB, solverBodyIdA, solverBodyIdB, frictionIndex, cp, cp.
m_combinedSpinningFriction, rel_pos1, rel_pos2, colObj0, colObj1, relaxation);
1093 if (axis0.
length() > 0.001)
1096 if (axis1.
length() > 0.001)
1127 addFrictionConstraint(cp.
m_lateralFrictionDir1, solverBodyIdA, solverBodyIdB, frictionIndex, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, infoGlobal);
1135 addFrictionConstraint(cp.
m_lateralFrictionDir2, solverBodyIdA, solverBodyIdB, frictionIndex, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, infoGlobal);
1144 addFrictionConstraint(cp.
m_lateralFrictionDir1, solverBodyIdA, solverBodyIdB, frictionIndex, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, infoGlobal);
1150 addFrictionConstraint(cp.
m_lateralFrictionDir2, solverBodyIdA, solverBodyIdB, frictionIndex, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, infoGlobal);
1161 addFrictionConstraint(cp.
m_lateralFrictionDir1, solverBodyIdA, solverBodyIdB, frictionIndex, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, infoGlobal, cp.
m_contactMotion1, cp.
m_frictionCFM);
1164 addFrictionConstraint(cp.
m_lateralFrictionDir2, solverBodyIdA, solverBodyIdB, frictionIndex, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation, infoGlobal, cp.
m_contactMotion2, cp.
m_frictionCFM);
1177 for (i = 0; i < numManifolds; i++)
1179 manifold = manifoldPtr[i];
1233 info2.erp = infoGlobal.
m_erp;
1241 info2.m_constraintError = ¤tConstraintRow->
m_rhs;
1244 info2.cfm = ¤tConstraintRow->
m_cfm;
1245 info2.m_lowerLimit = ¤tConstraintRow->
m_lowerLimit;
1246 info2.m_upperLimit = ¤tConstraintRow->
m_upperLimit;
1304 rel_vel = vel1Dotn + vel2Dotn;
1307 btScalar velocityError = restitution - rel_vel * info2.m_damping;
1310 solverConstraint.
m_rhs = penetrationImpulse + velocityImpulse;
1319 for (
int j = 0; j < numConstraints; j++)
1326 int totalNumRows = 0;
1330 for (
int i = 0; i < numConstraints; i++)
1342 if (constraints[i]->isEnabled())
1358 for (
int i = 0; i < numConstraints; i++)
1364 btAssert(currentRow < totalNumRows);
1374 convertJoint(currentConstraintRow, constraint, info1, solverBodyIdA, solverBodyIdB, infoGlobal);
1383 for (
int i = 0; i < numBodies; i++)
1389 #endif // BT_THREADSAFE 1397 for (
int i = 0; i < numBodies; i++)
1441 #ifdef BT_ADDITIONAL_DEBUG 1443 for (
int i = 0; i < numConstraints; i++)
1451 for (
int b = 0; b < numBodies; b++)
1464 for (
int b = 0; b < numBodies; b++)
1477 for (
int i = 0; i < numManifolds; i++)
1479 if (!manifoldPtr[i]->getBody0()->isStaticOrKinematicObject())
1482 for (
int b = 0; b < numBodies; b++)
1484 if (manifoldPtr[i]->getBody0() == bodies[b])
1492 if (!manifoldPtr[i]->getBody1()->isStaticOrKinematicObject())
1495 for (
int b = 0; b < numBodies; b++)
1497 if (manifoldPtr[i]->getBody1() == bodies[b])
1506 #endif //BT_ADDITIONAL_DEBUG 1531 for (i = 0; i < numNonContactPool; i++)
1535 for (i = 0; i < numConstraintPool; i++)
1539 for (i = 0; i < numFrictionPool; i++)
1551 btScalar leastSquaresResidual = 0.f;
1561 for (
int j = 0; j < numNonContactPool; ++j)
1572 for (
int j = 0; j < numConstraintPool; ++j)
1580 for (
int j = 0; j < numFrictionPool; ++j)
1598 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1604 for (
int j = 0; j < numConstraints; j++)
1606 if (constraints[j]->isEnabled())
1622 for (
int c = 0; c < numPoolConstraints; c++)
1629 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1633 bool applyFriction =
true;
1645 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1659 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1671 for (j = 0; j < numPoolConstraints; j++)
1675 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1681 for (j = 0; j < numFrictionPoolConstraints; j++)
1692 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1698 for (
int j = 0; j < numRollingFrictionPoolConstraints; j++)
1704 btScalar rollingFrictionMagnitude = rollingFrictionConstraint.
m_friction * totalImpulse;
1705 if (rollingFrictionMagnitude > rollingFrictionConstraint.
m_friction)
1706 rollingFrictionMagnitude = rollingFrictionConstraint.
m_friction;
1708 rollingFrictionConstraint.
m_lowerLimit = -rollingFrictionMagnitude;
1709 rollingFrictionConstraint.
m_upperLimit = rollingFrictionMagnitude;
1712 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1716 return leastSquaresResidual;
1721 BT_PROFILE(
"solveGroupCacheFriendlySplitImpulseIterations");
1726 for (iteration = 0; iteration < infoGlobal.
m_numIterations; iteration++)
1728 btScalar leastSquaresResidual = 0.f;
1732 for (j = 0; j < numPoolConstraints; j++)
1737 leastSquaresResidual =
btMax(leastSquaresResidual, residual * residual);
1740 if (leastSquaresResidual <= infoGlobal.m_leastSquaresResidualThreshold || iteration >= (infoGlobal.
m_numIterations - 1))
1742 #ifdef VERBOSE_RESIDUAL_PRINTF 1743 printf(
"residual = %f at iteration #%d\n", leastSquaresResidual, iteration);
1754 BT_PROFILE(
"solveGroupCacheFriendlyIterations");
1762 for (
int iteration = 0; iteration <
maxIterations; iteration++)
1769 #ifdef VERBOSE_RESIDUAL_PRINTF 1781 for (
int j = iBegin; j < iEnd; j++)
1801 for (
int j = iBegin; j < iEnd; j++)
1824 for (
int i = iBegin; i < iEnd; i++)
btSingleConstraintRowSolver getSSE4_1ConstraintRowSolverGeneric()
static T sum(const btAlignedObjectArray< T > &items)
btVector3 m_linearVelocity
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
btVector3 m_angularVelocity
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
const btVector3 & getDeltaAngularVelocity() const
int m_overrideNumSolverIterations
btScalar computeImpulseDenominator(const btVector3 &pos, const btVector3 &normal) const
virtual ~btSequentialImpulseConstraintSolver()
const btVector3 & getAngularVelocity() const
void setupFrictionConstraint(btSolverConstraint &solverConstraint, const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, const btContactSolverInfo &infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.)
virtual void getInfo1(btConstraintInfo1 *info)=0
internal method used by the constraint solver, don't use them directly
btConstraintArray m_tmpSolverContactFrictionConstraintPool
btConstraintArray m_tmpSolverContactRollingFrictionConstraintPool
const btVector3 & getPositionWorldOnA() const
btScalar m_combinedContactStiffness1
btVector3 m_lateralFrictionDir1
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
const btVector3 & getTotalTorque() const
btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const
explicit version is best avoided, it gains energy
btVector3 m_relpos1CrossNormal
void internalApplyImpulse(const btVector3 &linearComponent, const btVector3 &angularComponent, const btScalar impulseMagnitude)
btScalar m_appliedImpulseLateral1
btScalar m_rhsPenetration
virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal)
virtual void getInfo2(btConstraintInfo2 *info)=0
internal method used by the constraint solver, don't use them directly
btScalar m_combinedRestitution
static btScalar gResolveSplitPenetrationImpulse_scalar_reference(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &c)
btScalar length2() const
Return the length of the vector squared.
virtual void convertBodies(btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal)
virtual btScalar solveGroup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifold, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &info, btIDebugDraw *debugDrawer, btDispatcher *dispatcher)
btSequentialImpulseConstraintSolver Sequentially applies impulses
const btRigidBody & getRigidBodyA() const
int getNumContacts() const
static int getCpuFeatures()
1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and fr...
void btPlaneSpace1(const T &n, T &p, T &q)
void resizeNoInitialize(int newsize)
resize changes the number of elements in the array.
btScalar btSqrt(btScalar y)
btScalar m_appliedImpulse
btVector3 m_relpos2CrossNormal
bool isKinematicObject() const
btSingleConstraintRowSolver getSSE2ConstraintRowSolverLowerLimit()
btSingleConstraintRowSolver m_resolveSingleConstraintRowGeneric
const btVector3 & getTurnVelocity() const
const btVector3 & getLinearFactor() const
virtual btScalar solveSingleIteration(int iteration, btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
const btVector3 & internalGetInvMass() const
const btJointFeedback * getJointFeedback() const
btScalar resolveSingleConstraintRowLowerLimitSIMD(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
ManifoldContactPoint collects and maintains persistent contactpoints.
btScalar m_contactMotion1
btAlignedObjectArray< int > m_orderTmpConstraintPool
static btScalar gResolveSplitPenetrationImpulse_sse2(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &c)
static btScalar gResolveSingleConstraintRowGeneric_scalar_reference(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &c)
This is the scalar reference implementation of solving a single constraint row, the innerloop of the ...
btSingleConstraintRowSolver getScalarConstraintRowSolverGeneric()
Various implementations of solving a single constraint row using a generic equality constraint...
const btRigidBody & getRigidBodyB() const
btSingleConstraintRowSolver getScalarConstraintRowSolverLowerLimit()
Various implementations of solving a single constraint row using an inequality (lower limit) constrai...
void initSolverBody(btSolverBody *solverBody, btCollisionObject *collisionObject, btScalar timeStep)
btScalar getBreakingImpulseThreshold() const
bool isStaticOrKinematicObject() const
virtual btScalar solveGroupCacheFriendlyIterations(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
const btVector3 & getAngularFactor() const
btScalar resolveSingleConstraintRowLowerLimit(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
btVector3 m_externalTorqueImpulse
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
btVector3 m_appliedForceBodyB
static btScalar gResolveSingleConstraintRowLowerLimit_scalar_reference(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &c)
int getOrInitSolverBody(btCollisionObject &body, btScalar timeStep)
const btManifoldPoint & getContactPoint(int index) const
btVector3 m_externalForceImpulse
BT_ENABLE_GYROPSCOPIC_FORCE flags is enabled by default in Bullet 2.83 and onwards.
btVector3 & internalGetTurnVelocity()
#define btSimdScalar
Until we get other contributions, only use SIMD on Windows, when using Visual Studio 2008 or later...
btVector3 m_angularComponentA
btScalar m_combinedRollingFriction
btAlignedObjectArray< btSolverBody > m_tmpSolverBodyPool
void internalSetInvMass(const btVector3 &invMass)
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
void setupTorsionalFrictionConstraint(btSolverConstraint &solverConstraint, const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, btScalar combinedTorsionalFriction, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.)
btScalar(* btSingleConstraintRowSolver)(btSolverBody &, btSolverBody &, const btSolverConstraint &)
btTransform & getWorldTransform()
btVector3 m_normalWorldOnB
btVector3 m_appliedForceBodyA
const btVector3 & getLinearVelocity() const
void setFrictionConstraintImpulse(btSolverConstraint &solverConstraint, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal)
const btVector3 & getAnisotropicFriction() const
const btVector3 & getPositionWorldOnB() const
virtual void convertContacts(btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal)
const btCollisionObject * getBody0() const
btVector3 m_angularFactor
btScalar m_appliedImpulseLateral2
btScalar getInvMass() const
void setupSolverFunctions(bool useSimd)
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btScalar dot(const btVector3 &v) const
Return the dot product.
btConstraintArray m_tmpSolverContactConstraintPool
btSingleConstraintRowSolver getSSE2ConstraintRowSolverGeneric()
int getOverrideNumSolverIterations() const
btCollisionObject can be used to manage collision detection objects.
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
The btRigidBody is the main class for rigid body objects.
btVector3 m_angularComponentB
btScalar getContactProcessingThreshold() const
void writeBackContacts(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
int m_maxOverrideNumSolverIterations
void setCompanionId(int id)
int getWorldArrayIndex() const
btVector3 can be used to represent 3D points and vectors.
void getVelocityInLocalPointNoDelta(const btVector3 &rel_pos, btVector3 &velocity) const
btSingleConstraintRowSolver getSSE4_1ConstraintRowSolverLowerLimit()
int size() const
return the number of elements in the array
btScalar resolveSplitPenetrationImpulse(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
virtual void solveConstraintObsolete(btSolverBody &, btSolverBody &, btScalar)
internal method used by the constraint solver, don't use them directly
void convertContact(btPersistentManifold *manifold, const btContactSolverInfo &infoGlobal)
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
btScalar m_combinedContactDamping1
btSolverConstraint & addFrictionConstraint(const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, int frictionIndex, btManifoldPoint &cp, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, const btContactSolverInfo &infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.)
btVector3 m_appliedTorqueBodyB
btSimdScalar m_appliedPushImpulse
The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packe...
void * m_originalContactPoint
btAlignedObjectArray< btTypedConstraint::btConstraintInfo1 > m_tmpConstraintSizesPool
TypedConstraint is the baseclass for Bullet constraints and vehicles.
void resize(int newsize, const T &fillData=T())
btRigidBody * m_originalBody
void internalApplyPushImpulse(const btVector3 &linearComponent, const btVector3 &angularComponent, btScalar impulseMagnitude)
btVector3 & internalGetDeltaLinearVelocity()
some internal methods, don't use them
const btCollisionObject * getBody1() const
int getInternalType() const
reserved for Bullet internal usage
btScalar restitutionCurve(btScalar rel_vel, btScalar restitution, btScalar velocityThreshold)
int gNumSplitImpulseRecoveries
void setEnabled(bool enabled)
virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
btScalar resolveSingleConstraintRowGenericSIMD(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
btScalar m_contactMotion2
const T & btMax(const T &a, const T &b)
btScalar m_combinedFriction
virtual void convertJoints(btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal)
T & expand(const T &fillValue=T())
btVector3 m_appliedTorqueBodyA
btSolverConstraint & addTorsionalFrictionConstraint(const btVector3 &normalAxis, int solverBodyIdA, int solverBodyIdB, int frictionIndex, btManifoldPoint &cp, btScalar torsionalFriction, const btVector3 &rel_pos1, const btVector3 &rel_pos2, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, btScalar desiredVelocity=0, btScalar cfmSlip=0.f)
btVector3 & internalGetPushVelocity()
void writeBackBodies(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
btVector3 m_contactNormal1
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
btAlignedObjectArray< int > m_orderFrictionConstraintPool
bool hasAnisotropicFriction(int frictionMode=CF_ANISOTROPIC_FRICTION) const
const btVector3 & getTotalForce() const
void setupContactConstraint(btSolverConstraint &solverConstraint, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal, btScalar &relaxation, const btVector3 &rel_pos1, const btVector3 &rel_pos2)
const btVector3 & getDeltaLinearVelocity() const
btAlignedObjectArray< int > m_orderNonContactConstraintPool
btVector3 & internalGetDeltaAngularVelocity()
const btMatrix3x3 & getInvInertiaTensorWorld() const
void internalSetAppliedImpulse(btScalar appliedImpulse)
internal method used by the constraint solver, don't use them directly
virtual void reset()
clear internal cached data and reset random seed
unsigned long m_btSeed2
m_btSeed2 is used for re-arranging the constraint rows. improves convergence/quality of friction ...
btVector3 m_lateralFrictionDir2
btSimdScalar m_appliedImpulse
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
T & expandNonInitializing()
btScalar resolveSingleConstraintRowGeneric(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
const btVector3 & getPushVelocity() const
btSingleConstraintRowSolver m_resolveSingleConstraintRowLowerLimit
static void applyAnisotropicFriction(btCollisionObject *colObj, btVector3 &frictionDirection, int frictionMode)
int getCompanionId() const
btScalar getDistance() const
btSequentialImpulseConstraintSolver()
btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const
perform implicit force computation in body space (inertial frame)
virtual void buildJacobian()
internal method used by the constraint solver, don't use them directly
btConstraintArray m_tmpSolverNonContactConstraintPool
void convertJoint(btSolverConstraint *currentConstraintRow, btTypedConstraint *constraint, const btTypedConstraint::btConstraintInfo1 &info1, int solverBodyIdA, int solverBodyIdB, const btContactSolverInfo &infoGlobal)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar m_combinedSpinningFriction
btVector3 m_contactNormal2
btScalar length() const
Return the length of the vector.
btAlignedObjectArray< int > m_kinematicBodyUniqueIdToSolverBodyTable
btScalar btFabs(btScalar x)
btTransform m_worldTransform
btSingleConstraintRowSolver m_resolveSplitPenetrationImpulse
btScalar m_leastSquaresResidual
void writeBackJoints(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)