78 for (
int i=0;i<numBodies;i++)
94 for (
int i = 0; i < ndof; ++i)
112 for (
int i = 0; i < ndofA; ++i)
123 for (
int i = 0; i < ndofB; ++i)
184 for (
int i = 0; i < ndofA; ++i)
191 for (
int i = 0; i < ndofB; ++i)
235 BT_PROFILE(
"setupMultiBodyContactConstraint");
334 for (
int i = 0; i < ndofA; ++i)
353 for (
int i = 0; i < ndofB; ++i)
369 if (multiBodyA && (multiBodyA==multiBodyB))
372 for (
int i = 0; i < ndofA; ++i)
374 denom1 += jacB[i] * lambdaA[i];
375 denom1 += jacA[i] * lambdaB[i];
409 for (
int i = 0; i < ndofA ; ++i)
422 for (
int i = 0; i < ndofB ; ++i)
485 btScalar velocityError = restitution - rel_vel;
491 erp = infoGlobal.
m_erp;
497 velocityError = -penetration / infoGlobal.
m_timeStep;
501 positionalError = -penetration * erp/infoGlobal.
m_timeStep;
510 solverConstraint.
m_rhs = penetrationImpulse+velocityImpulse;
516 solverConstraint.
m_rhs = velocityImpulse;
520 solverConstraint.
m_cfm = 0.f;
535 bool isFriction =
true;
554 solverConstraint.
m_linkB = fcB->m_link;
559 return solverConstraint;
586 int rollingFriction=1;
612 solverConstraint.
m_linkB = fcB->m_link;
616 bool isFriction =
false;
623 #define ENABLE_FRICTION
624 #ifdef ENABLE_FRICTION
643 if (relAngVel.
length()>0.001)
662 #endif //ROLLING_FRICTION
736 #endif //ENABLE_FRICTION
746 for (
int i=0;i<numManifolds;i++)
783 void btMultiBodyConstraintSolver::solveMultiBodyGroup(
btCollisionObject** bodies,
int numBodies,
btPersistentManifold** manifold,
int numManifolds,
btTypedConstraint** constraints,
int numConstraints,
btMultiBodyConstraint** multiBodyConstraints,
int numMultiBodyConstraints,
const btContactSolverInfo& info,
btIDebugDraw* debugDrawer,
btDispatcher* dispatcher)
btScalar getInvMass() const
void calcAccelerationDeltas(const btScalar *force, btScalar *output, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v) const
static T sum(const btAlignedObjectArray< T > &items)
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
btScalar m_rhsPenetration
btPersistentManifold is a contact point cache, it stays persistent as long as objects are overlapping...
static btMultiBodyLinkCollider * upcast(btCollisionObject *colObj)
void setupMultiBodyContactConstraint(btMultiBodySolverConstraint &solverConstraint, const btVector3 &contactNormal, btManifoldPoint &cp, const btContactSolverInfo &infoGlobal, btScalar &relaxation, bool isFriction, btScalar desiredVelocity=0, btScalar cfmSlip=0)
btVector3 m_relpos1CrossNormal
1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and fr...
btVector3 m_contactNormal2
btVector3 m_lateralFrictionDir1
btAlignedObjectArray< btScalar > scratch_r
btAlignedObjectArray< btScalar > m_deltaVelocities
virtual void createConstraintRows(btMultiBodyConstraintArray &constraintRows, btMultiBodyJacobianData &data, const btContactSolverInfo &infoGlobal)=0
void internalApplyImpulse(const btVector3 &linearComponent, const btVector3 &angularComponent, const btScalar impulseMagnitude)
btAlignedObjectArray< btSolverBody > * m_solverBodyPool
const btVector3 & getAngularFactor() const
virtual btScalar solveSingleIteration(int iteration, btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
btVector3 m_angularComponentA
btVector3 m_angularComponentB
btScalar m_combinedRestitution
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
void btPlaneSpace1(const T &n, T &p, T &q)
btScalar m_appliedImpulse
virtual btScalar solveSingleIteration(int iteration, btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
ManifoldContactPoint collects and maintains persistent contactpoints.
const btCollisionObject * getBody0() const
btScalar m_contactMotion1
int m_tmpNumMultiBodyConstraints
btScalar restitutionCurve(btScalar rel_vel, btScalar restitution)
btAlignedObjectArray< btMatrix3x3 > scratch_m
btScalar dot(const btVector3 &v) const
Return the dot product.
void applyDeltaVee(const btScalar *delta_vee)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
virtual btScalar solveGroup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifold, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &info, btIDebugDraw *debugDrawer, btDispatcher *dispatcher)
this method should not be called, it was just used during porting/integration of Featherstone btMulti...
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
btMultiBodyConstraintArray m_multiBodyNonContactConstraints
int getOrInitSolverBody(btCollisionObject &body, btScalar timeStep)
btAlignedObjectArray< btScalar > m_deltaVelocitiesUnitImpulse
btScalar m_combinedRollingFriction
btAlignedObjectArray< btSolverBody > m_tmpSolverBodyPool
void resolveSingleConstraintRowGeneric(const btMultiBodySolverConstraint &c)
btVector3 m_normalWorldOnB
int size() const
return the number of elements in the array
virtual void solveMultiBodyGroup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifold, int numManifolds, btTypedConstraint **constraints, int numConstraints, btMultiBodyConstraint **multiBodyConstraints, int numMultiBodyConstraints, const btContactSolverInfo &info, btIDebugDraw *debugDrawer, btDispatcher *dispatcher)
btMultiBody * m_multiBodyA
void setCompanionId(int id)
const btVector3 & getAngularVelocity() const
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
void convertContacts(btPersistentManifold **manifoldPtr, int numManifolds, const btContactSolverInfo &infoGlobal)
btCollisionObject can be used to manage collision detection objects.
btScalar getContactProcessingThreshold() const
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
btMultiBody * m_multiBodyB
The btRigidBody is the main class for rigid body objects.
btScalar length() const
Return the length of the vector.
const btManifoldPoint & getContactPoint(int index) const
btMultiBodyConstraintArray m_multiBodyFrictionContactConstraints
btAlignedObjectArray< btScalar > m_jacobians
const btVector3 & internalGetInvMass() const
void * m_originalContactPoint
const btVector3 & getPositionWorldOnB() const
btVector3 can be used to represent 3D points and vectors.
void convertContact(btPersistentManifold *manifold, const btContactSolverInfo &infoGlobal)
btAlignedObjectArray< btVector3 > scratch_v
btSimdScalar m_appliedImpulse
btMultiBodySolverConstraint & addMultiBodyFrictionConstraint(const btVector3 &normalAxis, btPersistentManifold *manifold, int frictionIndex, btManifoldPoint &cp, btCollisionObject *colObj0, btCollisionObject *colObj1, btScalar relaxation, const btContactSolverInfo &infoGlobal, btScalar desiredVelocity=0, btScalar cfmSlip=0)
btSolverConstraint & addRollingFrictionConstraint(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, btScalar desiredVelocity=0, btScalar cfmSlip=0.f)
The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packe...
int getCompanionId() const
void resolveSingleConstraintRowGenericMultiBody(const btMultiBodySolverConstraint &c)
TypedConstraint is the baseclass for Bullet constraints and vehicles.
void resize(int newsize, const T &fillData=T())
btRigidBody * m_originalBody
int getNumContacts() const
btVector3 & internalGetDeltaLinearVelocity()
some internal methods, don't use them
void convertMultiBodyContact(btPersistentManifold *manifold, const btContactSolverInfo &infoGlobal)
virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
static float4 cross(const float4 &a, const float4 &b)
virtual btScalar solveGroupCacheFriendlySetup(btCollisionObject **bodies, int numBodies, btPersistentManifold **manifoldPtr, int numManifolds, btTypedConstraint **constraints, int numConstraints, const btContactSolverInfo &infoGlobal, btIDebugDraw *debugDrawer)
void applyDeltaVee(btScalar *deltaV, btScalar impulse, int velocityIndex, int ndof)
btMultiBodyConstraintArray m_multiBodyNormalContactConstraints
btScalar m_contactMotion2
const btMatrix3x3 & getInvInertiaTensorWorld() const
btScalar m_combinedFriction
bool m_lateralFrictionInitialized
btMultiBodyConstraint ** m_tmpMultiBodyConstraints
void fillContactJacobian(int link, const btVector3 &contact_point, const btVector3 &normal, btScalar *jac, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m) const
const btVector3 & getPositionWorldOnA() const
btVector3 m_relpos2CrossNormal
const btTransform & getWorldTransform() const
btVector3 & internalGetDeltaAngularVelocity()
btVector3 m_lateralFrictionDir2
btMultiBody * m_multiBody
btSimdScalar m_appliedPushImpulse
btScalar getDistance() const
The btDispatcher interface class can be used in combination with broadphase to dispatch calculations ...
const btVector3 & getLinearFactor() const
T & expandNonInitializing()
btVector3 m_contactNormal1
static void applyAnisotropicFriction(btCollisionObject *colObj, btVector3 &frictionDirection, int frictionMode)
const btCollisionObject * getBody1() const
const btScalar * getVelocityVector() const
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btMultiBodyJacobianData m_data
btScalar btFabs(btScalar x)