73 int solverBodyIdA = contactConstraint.m_solverBodyIdA;
74 int solverBodyIdB = contactConstraint.m_solverBodyIdB;
76 btSolverBody* solverBodyA = &m_tmpSolverBodyPool[solverBodyIdA];
77 btSolverBody* solverBodyB = &m_tmpSolverBodyPool[solverBodyIdB];
87 rel_pos1 = pos1 - solverBodyA->getWorldTransform().getOrigin();
88 rel_pos2 = pos2 - solverBodyB->getWorldTransform().getOrigin();
93 solverBodyA->getVelocityInLocalPointNoDelta(rel_pos1, vel1);
94 solverBodyB->getVelocityInLocalPointNoDelta(rel_pos2, vel2);
103 if (rollingFrictionIndex >= 0)
106 btAssert(spinningFrictionConstraint.m_frictionIndex == iContactConstraint);
134 const btScalar kRollingFrictionThreshold = 0.001f;
135 for (
int i = 0; i < 2; ++i)
137 int iRollingFric = rollingFrictionIndex + 1 + i;
139 btAssert(rollingFrictionConstraint.m_frictionIndex == iContactConstraint);
141 if (dir.length() > kRollingFrictionThreshold)
159 rollingFrictionConstraint.m_frictionIndex = -1;
183 btAssert(frictionConstraint1->m_frictionIndex == iContactConstraint);
189 btAssert(frictionConstraint2->m_frictionIndex == iContactConstraint);
201 setupFrictionConstraint(*frictionConstraint1, cp.
m_lateralFrictionDir1, solverBodyIdA, solverBodyIdB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation,
infoGlobal);
203 if (frictionConstraint2)
209 setupFrictionConstraint(*frictionConstraint2, cp.
m_lateralFrictionDir2, solverBodyIdA, solverBodyIdB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation,
infoGlobal);
218 setupFrictionConstraint(*frictionConstraint1, cp.
m_lateralFrictionDir1, solverBodyIdA, solverBodyIdB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation,
infoGlobal);
220 if (frictionConstraint2)
224 setupFrictionConstraint(*frictionConstraint2, cp.
m_lateralFrictionDir2, solverBodyIdA, solverBodyIdB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation,
infoGlobal);
235 setupFrictionConstraint(*frictionConstraint1, cp.
m_lateralFrictionDir1, solverBodyIdA, solverBodyIdB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation,
infoGlobal, cp.
m_contactMotion1, cp.
m_frictionCFM);
236 if (frictionConstraint2)
238 setupFrictionConstraint(*frictionConstraint2, cp.
m_lateralFrictionDir2, solverBodyIdA, solverBodyIdB, cp, rel_pos1, rel_pos2, colObj0, colObj1, relaxation,
infoGlobal, cp.
m_contactMotion2, cp.
m_frictionCFM);
261 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
280 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
304 int solverBodyId = -1;
306 if (isRigidBodyType && !body.isStaticOrKinematicObject())
310 solverBodyId = body.getCompanionId();
311 if (solverBodyId < 0)
315 solverBodyId = body.getCompanionId();
316 if (solverBodyId < 0)
318 solverBodyId = m_tmpSolverBodyPool.size();
319 btSolverBody& solverBody = m_tmpSolverBodyPool.expand();
321 body.setCompanionId(solverBodyId);
326 else if (isRigidBodyType && body.isKinematicObject())
335 int uniqueId = body.getWorldArrayIndex();
336 const int INVALID_SOLVER_BODY_ID = -1;
349 if (INVALID_SOLVER_BODY_ID == solverBodyId)
356 if (INVALID_SOLVER_BODY_ID == solverBodyId)
359 solverBodyId = m_tmpSolverBodyPool.
size();
360 btSolverBody& solverBody = m_tmpSolverBodyPool.expand();
385 btAssert(solverBodyId >= 0 && solverBodyId < m_tmpSolverBodyPool.size());
391 BT_PROFILE(
"internalCollectContactManifoldCachedInfo");
406 btSolverBody* solverBodyA = &m_tmpSolverBodyPool[solverBodyIdA];
407 btSolverBody* solverBodyB = &m_tmpSolverBodyPool[solverBodyIdB];
412 btAssert(!m_tmpSolverBodyPool[solverBodyIdA].
m_invMass.isZero() || !m_tmpSolverBodyPool[solverBodyIdB].m_invMass.isZero());
415 for (
int j = 0; j < manifold->getNumContacts(); j++)
419 if (cp.
getDistance() <= manifold->getContactProcessingThreshold())
452 BT_PROFILE(
"internalAllocContactConstraints");
454 for (
int iManifold = 0; iManifold <
numManifolds; ++iManifold)
463 contactConstraint.m_solverBodyIdA = cachedInfo.
solverBodyIds[0];
464 contactConstraint.m_solverBodyIdB = cachedInfo.
solverBodyIds[1];
465 contactConstraint.m_originalContactPoint = cachedInfo.
contactPoints[i];
468 contactConstraint.m_frictionIndex = frictionIndex;
472 frictionConstraint.m_frictionIndex = contactIndex;
481 for (
int i = 0; i < 3; i++)
484 rollingFrictionIndex++;
534 int numRollingFrictionConstraints = 0;
535 for (
int iManifold = 0; iManifold <
numManifolds; ++iManifold)
545 numRollingFrictionConstraints += 3;
554 int extraReserve = numContacts / 16;
601 for (
int i = iBegin; i < iEnd; i++)
605 if (constraint->isEnabled())
607 constraint->buildJacobian();
608 constraint->internalSetAppliedImpulse(0.0f);
612 fb->m_appliedForceBodyA.setZero();
613 fb->m_appliedTorqueBodyA.setZero();
614 fb->m_appliedForceBodyB.setZero();
615 fb->m_appliedTorqueBodyB.setZero();
617 constraint->getInfo1(&info1);
621 info1.m_numConstraintRows = 0;
646 for (
int i = iBegin; i < iEnd; ++i)
648 const JointParams& jointParams = jointParamsArray[i];
650 if (currentRow != -1)
654 btAssert(info1.m_numConstraintRows > 0);
694 bool parallelJointSetup =
true;
696 if (parallelJointSetup)
707 int totalNumRows = 0;
719 if (info1.m_numConstraintRows)
721 params.m_solverConstraint = totalNumRows;
727 params.m_solverConstraint = -1;
729 totalNumRows += info1.m_numConstraintRows;
734 if (parallelJointSetup)
750 for (
int i = iBegin; i < iEnd; i++)
753 obj->setCompanionId(i);
769 solverBody.m_externalTorqueImpulse += gyroForce;
774 solverBody.m_externalTorqueImpulse += gyroForce;
807 m_tmpSolverBodyPool.resizeNoInitialize(
numBodies + 1);
815 bool parallelBodySetup =
true;
816 if (parallelBodySetup)
860 btScalar leastSquaresResidual = 0.f;
861 for (
int iiCons = batchBegin; iiCons < batchEnd; ++iiCons)
863 int iCons = consIndices[iiCons];
865 btSolverBody& bodyA = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA];
866 btSolverBody& bodyB = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB];
868 leastSquaresResidual += residual * residual;
870 return leastSquaresResidual;
885 BT_PROFILE(
"ContactSplitPenetrationImpulseSolverLoop");
887 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
898 BT_PROFILE(
"solveGroupCacheFriendlySplitImpulseIterations");
903 btScalar leastSquaresResidual = 0.f;
908 btScalar leastSquaresResidual = 0.f;
909 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
924 #ifdef VERBOSE_RESIDUAL_PRINTF
925 printf(
"residual = %f at iteration #%d\n", leastSquaresResidual, iteration);
940 btScalar leastSquaresResidual = 0.f;
992 return leastSquaresResidual;
997 btScalar leastSquaresResidual = 0.f;
998 for (
int iiCons = batchBegin; iiCons < batchEnd; ++iiCons)
1000 int iCons = consIndices[iiCons];
1002 if (iteration < constraint.m_overrideNumSolverIterations)
1004 btSolverBody& bodyA = m_tmpSolverBodyPool[constraint.m_solverBodyIdA];
1005 btSolverBody& bodyB = m_tmpSolverBodyPool[constraint.m_solverBodyIdB];
1007 leastSquaresResidual += residual * residual;
1010 return leastSquaresResidual;
1015 btScalar leastSquaresResidual = 0.f;
1016 for (
int iiCons = batchBegin; iiCons < batchEnd; ++iiCons)
1018 int iCons = consIndices[iiCons];
1020 btSolverBody& bodyA = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA];
1021 btSolverBody& bodyB = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB];
1023 leastSquaresResidual += residual * residual;
1025 return leastSquaresResidual;
1030 btScalar leastSquaresResidual = 0.f;
1031 for (
int iiCons = batchBegin; iiCons < batchEnd; ++iiCons)
1033 int iContact = consIndices[iiCons];
1037 if (totalImpulse > 0.0f)
1041 for (
int iFriction = iBegin; iFriction < iEnd; ++iFriction)
1044 btAssert(solveManifold.m_frictionIndex == iContact);
1046 solveManifold.m_lowerLimit = -(solveManifold.m_friction * totalImpulse);
1047 solveManifold.m_upperLimit = solveManifold.m_friction * totalImpulse;
1049 btSolverBody& bodyA = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA];
1050 btSolverBody& bodyB = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB];
1052 leastSquaresResidual += residual * residual;
1056 return leastSquaresResidual;
1061 btScalar leastSquaresResidual = 0.f;
1062 for (
int iiCons = batchBegin; iiCons < batchEnd; ++iiCons)
1064 int iContact = consIndices[iiCons];
1066 if (iFirstRollingFriction >= 0)
1070 if (totalImpulse > 0.0f)
1072 int iBegin = iFirstRollingFriction;
1073 int iEnd = iBegin + 3;
1074 for (
int iRollingFric = iBegin; iRollingFric < iEnd; ++iRollingFric)
1077 if (rollingFrictionConstraint.m_frictionIndex != iContact)
1081 btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction * totalImpulse;
1082 if (rollingFrictionMagnitude > rollingFrictionConstraint.m_friction)
1084 rollingFrictionMagnitude = rollingFrictionConstraint.m_friction;
1087 rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude;
1088 rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude;
1090 btScalar residual =
resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA], m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB], rollingFrictionConstraint);
1091 leastSquaresResidual += residual * residual;
1096 return leastSquaresResidual;
1103 btScalar leastSquaresResidual = 0.f;
1106 for (
int iiCons = batchBegin; iiCons < batchEnd; iiCons++)
1109 int iContact = contactIndices[iiCons];
1114 leastSquaresResidual += residual * residual;
1115 totalImpulse = solveManifold.m_appliedImpulse;
1119 if (totalImpulse > 0.0f)
1123 for (
int iFriction = iBegin; iFriction < iEnd; ++iFriction)
1126 btAssert(solveManifold.m_frictionIndex == iContact);
1128 solveManifold.m_lowerLimit = -(solveManifold.m_friction * totalImpulse);
1129 solveManifold.m_upperLimit = solveManifold.m_friction * totalImpulse;
1131 btSolverBody& bodyA = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA];
1132 btSolverBody& bodyB = m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB];
1134 leastSquaresResidual += residual * residual;
1140 if (totalImpulse > 0.0f && iFirstRollingFriction >= 0)
1142 int iBegin = iFirstRollingFriction;
1143 int iEnd = iBegin + 3;
1144 for (
int iRollingFric = iBegin; iRollingFric < iEnd; ++iRollingFric)
1147 if (rollingFrictionConstraint.m_frictionIndex != iContact)
1151 btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction * totalImpulse;
1152 if (rollingFrictionMagnitude > rollingFrictionConstraint.m_friction)
1154 rollingFrictionMagnitude = rollingFrictionConstraint.m_friction;
1157 rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude;
1158 rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude;
1160 btScalar residual =
resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA], m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB], rollingFrictionConstraint);
1161 leastSquaresResidual += residual * residual;
1165 return leastSquaresResidual;
1179 for (
int iBatch = 0; iBatch < bc.
m_batches.size(); ++iBatch)
1183 for (
int iiCons =
batch.begin; iiCons <
batch.end; ++iiCons)
1198 if (iteration < numIterations)
1220 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
1234 btScalar leastSquaresResidual = 0.f;
1235 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
1242 return leastSquaresResidual;
1259 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
1273 btScalar leastSquaresResidual = 0.f;
1274 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
1281 return leastSquaresResidual;
1298 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
1309 BT_PROFILE(
"resolveAllContactFrictionConstraints");
1312 btScalar leastSquaresResidual = 0.f;
1313 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
1320 return leastSquaresResidual;
1337 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
1348 BT_PROFILE(
"resolveAllContactConstraintsInterleaved");
1351 btScalar leastSquaresResidual = 0.f;
1352 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
1359 return leastSquaresResidual;
1376 for (
int iBatch = iBegin; iBatch < iEnd; ++iBatch)
1387 BT_PROFILE(
"resolveAllRollingFrictionConstraints");
1388 btScalar leastSquaresResidual = 0.f;
1411 btScalar leastSquaresResidual = 0.f;
1412 for (
int iiPhase = 0; iiPhase < batchedCons.
m_phases.size(); ++iiPhase)
1423 for (
int j = 0; j < numRollingFrictionPoolConstraints; j++)
1426 if (rollingFrictionConstraint.m_frictionIndex >= 0)
1429 if (totalImpulse > 0.0f)
1431 btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction * totalImpulse;
1432 if (rollingFrictionMagnitude > rollingFrictionConstraint.m_friction)
1433 rollingFrictionMagnitude = rollingFrictionConstraint.m_friction;
1435 rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude;
1436 rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude;
1438 btScalar residual =
resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA], m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB], rollingFrictionConstraint);
1439 leastSquaresResidual += residual * residual;
1444 return leastSquaresResidual;
1532 int grainSize = 500;
1538 int grainSize = 400;
1543 int grainSize = 100;
1544 btParallelFor(0, m_tmpSolverBodyPool.size(), grainSize, loop);
1552 m_tmpSolverBodyPool.resizeNoInitialize(0);
@ CF_ANISOTROPIC_FRICTION
@ CF_ANISOTROPIC_ROLLING_FRICTION
const btRigidBody & getRigidBodyA() const
const btRigidBody & getRigidBodyB() const
@ BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED
virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
virtual btScalar solveGroupCacheFriendlyFinish(btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal)
virtual btScalar solveSingleIteration(int iteration, btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
@ BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_BODY
@ BT_ENABLE_GYROSCOPIC_FORCE_EXPLICIT
@ BT_ENABLE_GYROSCOPIC_FORCE_IMPLICIT_WORLD
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
SIMD_FORCE_INLINE btScalar btSqrt(btScalar y)
SIMD_FORCE_INLINE void btSwap(T &a, T &b)
virtual void setupBatchedContactConstraints()
void internalCollectContactManifoldCachedInfo(btContactManifoldCachedInfo *cachedInfoArray, btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal)
virtual btScalar resolveAllRollingFrictionConstraints()
void internalWriteBackBodies(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
btBatchedConstraints m_batchedContactConstraints
btAlignedObjectArray< int > m_rollingFrictionIndexTable
void internalAllocContactConstraints(const btContactManifoldCachedInfo *cachedInfoArray, int numManifolds)
void internalConvertMultipleJoints(const btAlignedObjectArray< JointParams > &jointParamsArray, btTypedConstraint **constraints, int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
btSequentialImpulseConstraintSolverMt()
virtual btScalar resolveAllJointConstraints(int iteration)
int m_numFrictionDirections
void internalWriteBackContacts(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
virtual void randomizeConstraintOrdering(int iteration, int numIterations)
btSpinMutex m_kinematicBodyUniqueIdToSolverBodyTableMutex
btBatchedConstraints m_batchedJointConstraints
static btBatchedConstraints::BatchingMethod s_contactBatchingMethod
int getOrInitSolverBodyThreadsafe(btCollisionObject &body, btScalar timeStep)
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint ** constraints
btScalar resolveMultipleContactRollingFrictionConstraints(const btAlignedObjectArray< int > &consIndices, int batchBegin, int batchEnd)
btScalar resolveMultipleContactConstraintsInterleaved(const btAlignedObjectArray< int > &contactIndices, int batchBegin, int batchEnd)
btSequentialImpulseConstraintSolverMt int btPersistentManifold ** manifoldPtr
virtual btScalar resolveAllContactFrictionConstraints()
void internalInitMultipleJoints(btTypedConstraint **constraints, int iBegin, int iEnd)
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint int const btContactSolverInfo btIDebugDraw *debugDrawer BT_OVERRIDE
btSpinMutex m_bodySolverArrayMutex
void randomizeBatchedConstraintOrdering(btBatchedConstraints *batchedConstraints)
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint int numConstraints
virtual void setupBatchedJointConstraints()
void internalWriteBackJoints(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
btAlignedObjectArray< char > m_scratchMemory
btSequentialImpulseConstraintSolverMt int numBodies
void internalSetupContactConstraints(int iContactConstraint, const btContactSolverInfo &infoGlobal)
btScalar resolveMultipleContactSplitPenetrationImpulseConstraints(const btAlignedObjectArray< int > &consIndices, int batchBegin, int batchEnd)
static bool s_allowNestedParallelForLoops
btSequentialImpulseConstraintSolverMt int btPersistentManifold int btTypedConstraint int const btContactSolverInfo & infoGlobal
virtual btScalar resolveAllContactConstraints()
virtual ~btSequentialImpulseConstraintSolverMt()
btScalar resolveMultipleJointConstraints(const btAlignedObjectArray< int > &consIndices, int batchBegin, int batchEnd, int iteration)
btSequentialImpulseConstraintSolverMt int btPersistentManifold int numManifolds
void allocAllContactConstraints(btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal)
void setupAllContactConstraints(const btContactSolverInfo &infoGlobal)
static int s_minBatchSize
virtual btScalar resolveAllContactConstraintsInterleaved()
btScalar resolveMultipleContactFrictionConstraints(const btAlignedObjectArray< int > &consIndices, int batchBegin, int batchEnd)
btScalar resolveMultipleContactConstraints(const btAlignedObjectArray< int > &consIndices, int batchBegin, int batchEnd)
static int s_maxBatchSize
bool m_useObsoleteJointConstraints
void internalConvertBodies(btCollisionObject **bodies, int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
static int s_minimumContactManifoldsForBatching
static btBatchedConstraints::BatchingMethod s_jointBatchingMethod
void initSolverBody(btSolverBody *solverBody, btCollisionObject *collisionObject, btScalar timeStep)
virtual void convertJoints(btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal)
void writeBackJoints(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
btConstraintArray m_tmpSolverContactRollingFrictionConstraintPool
btAlignedObjectArray< int > m_orderTmpConstraintPool
virtual void solveGroupCacheFriendlySplitImpulseIterations(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
virtual void convertContacts(btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal)
void convertJoint(btSolverConstraint *currentConstraintRow, btTypedConstraint *constraint, const btTypedConstraint::btConstraintInfo1 &info1, int solverBodyIdA, int solverBodyIdB, const btContactSolverInfo &infoGlobal)
btAlignedObjectArray< int > m_kinematicBodyUniqueIdToSolverBodyTable
btScalar resolveSingleConstraintRowLowerLimit(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
static void applyAnisotropicFriction(btCollisionObject *colObj, btVector3 &frictionDirection, int frictionMode)
btScalar resolveSingleConstraintRowGeneric(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
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 resolveSplitPenetrationImpulse(btSolverBody &bodyA, btSolverBody &bodyB, const btSolverConstraint &contactConstraint)
void writeBackBodies(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
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.)
btConstraintArray m_tmpSolverContactFrictionConstraintPool
btConstraintArray m_tmpSolverContactConstraintPool
virtual void convertBodies(btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal)
void setFrictionConstraintImpulse(btSolverConstraint &solverConstraint, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal)
int getOrInitSolverBody(btCollisionObject &body, btScalar timeStep)
void writeBackContacts(int iBegin, int iEnd, const btContactSolverInfo &infoGlobal)
btConstraintArray m_tmpSolverNonContactConstraintPool
void setupContactConstraint(btSolverConstraint &solverConstraint, int solverBodyIdA, int solverBodyIdB, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal, btScalar &relaxation, const btVector3 &rel_pos1, const btVector3 &rel_pos2)
btAlignedObjectArray< btTypedConstraint::btConstraintInfo1 > m_tmpConstraintSizesPool
static T sum(const btAlignedObjectArray< T > &items)
btSolverBody
The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packe...
btSolverConstraint
1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and fr...
btScalar btParallelSum(int iBegin, int iEnd, int grainSize, const btIParallelSumBody &body)
bool btThreadsAreRunning()
void btParallelFor(int iBegin, int iEnd, int grainSize, const btIParallelForBody &body)
btTypedConstraint(btTypedConstraintType type, btRigidBody &rbA)
SIMD_FORCE_INLINE void btPlaneSpace1(const T &n, T &p, T &q)
SIMD_FORCE_INLINE btScalar length2() const
Return the length of the vector squared.
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE void reserve(int _Count)
SIMD_FORCE_INLINE int capacity() const
return the pre-allocated (reserved) elements, this is at least as large as the total number of elemen...
SIMD_FORCE_INLINE void resizeNoInitialize(int newsize)
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
void swap(int index0, int index1)
SIMD_FORCE_INLINE void resize(int newsize, const T &fillData=T())
btScalar m_combinedSpinningFriction
btScalar m_combinedRollingFriction
btScalar getDistance() const
const btVector3 & getPositionWorldOnB() const
btVector3 m_lateralFrictionDir2
const btVector3 & getPositionWorldOnA() const
btVector3 m_normalWorldOnB
btScalar m_contactMotion2
btVector3 m_lateralFrictionDir1
btScalar m_contactMotion1
btScalar getInvMass() const
static const btRigidBody * upcast(const btCollisionObject *colObj)
btVector3 computeGyroscopicImpulseImplicit_World(btScalar dt) const
perform implicit force computation in world space
btVector3 computeGyroscopicImpulseImplicit_Body(btScalar step) const
perform implicit force computation in body space (inertial frame)
const btMatrix3x3 & getInvInertiaTensorWorld() const
btVector3 computeGyroscopicForceExplicit(btScalar maxGyroscopicForce) const
explicit version is best avoided, it gains energy
BLI_INLINE float fb(float length, float L)
btSequentialImpulseConstraintSolverMt * m_solver
btCollisionObject ** m_bodies
void forLoop(int iBegin, int iEnd) const BT_OVERRIDE
ConvertBodiesLoop(btSequentialImpulseConstraintSolverMt *solver, btCollisionObject **bodies, int numBodies, const btContactSolverInfo &infoGlobal)
const btContactSolverInfo & m_infoGlobal
btSequentialImpulseConstraintSolverMt * m_solver
const btContactSolverInfo & m_infoGlobal
btTypedConstraint ** m_srcConstraints
const btAlignedObjectArray< btSequentialImpulseConstraintSolverMt::JointParams > & m_jointParamsArray
void forLoop(int iBegin, int iEnd) const BT_OVERRIDE
ConvertJointsLoop(btSequentialImpulseConstraintSolverMt *solver, const btAlignedObjectArray< btSequentialImpulseConstraintSolverMt::JointParams > &jointParamsArray, btTypedConstraint **srcConstraints, const btContactSolverInfo &infoGlobal)
btTypedConstraint ** m_constraints
void forLoop(int iBegin, int iEnd) const BT_OVERRIDE
InitJointsLoop(btSequentialImpulseConstraintSolverMt *solver, btTypedConstraint **constraints)
btSequentialImpulseConstraintSolverMt * m_solver
JointSolverLoop(btSequentialImpulseConstraintSolverMt *solver, const btBatchedConstraints *bc, int iteration)
btScalar sumLoop(int iBegin, int iEnd) const BT_OVERRIDE
btSequentialImpulseConstraintSolverMt * m_solver
const btBatchedConstraints * m_bc
void forLoop(int iBegin, int iEnd) const BT_OVERRIDE
const btContactSolverInfo * m_infoGlobal
WriteBodiesLoop(btSequentialImpulseConstraintSolverMt *solver, const btContactSolverInfo &infoGlobal)
btSequentialImpulseConstraintSolverMt * m_solver
WriteJointsLoop(btSequentialImpulseConstraintSolverMt *solver, const btContactSolverInfo &infoGlobal)
const btContactSolverInfo * m_infoGlobal
void forLoop(int iBegin, int iEnd) const BT_OVERRIDE
btSequentialImpulseConstraintSolverMt * m_solver
btAlignedObjectArray< Range > m_batches
btAlignedObjectArray< int > m_constraintIndices
void setup(btConstraintArray *constraints, const btAlignedObjectArray< btSolverBody > &bodies, BatchingMethod batchingMethod, int minBatchSize, int maxBatchSize, btAlignedObjectArray< char > *scratchMemory)
btAlignedObjectArray< char > m_phaseGrainSize
btAlignedObjectArray< int > m_phaseOrder
btAlignedObjectArray< Range > m_phases
btIDebugDraw * m_debugDrawer
@ BATCHING_METHOD_SPATIAL_GRID_2D