14 m_isUnilateral(isUnilateral),
15 m_numDofsFinalized(-1),
16 m_maxAppliedImpulse(100)
49 for (
int i = 0; i < ndof; ++i)
89 if (solverConstraint.
m_linkA < 0)
91 rel_pos1 = posAworld - multiBodyA->
getBasePos();
98 const int ndofA = multiBodyA->
getNumDofs() + 6;
120 for (
int i = 0; i < ndofA; i++)
141 torqueAxis0 = constraintNormalAng;
145 torqueAxis0 = rel_pos1.
cross(constraintNormalLin);
155 torqueAxis0 = constraintNormalAng;
159 torqueAxis0 = rel_pos1.
cross(constraintNormalLin);
168 if (solverConstraint.
m_linkB < 0)
170 rel_pos2 = posBworld - multiBodyB->
getBasePos();
177 const int ndofB = multiBodyB->
getNumDofs() + 6;
194 for (
int i = 0; i < ndofB; i++)
214 torqueAxis1 = constraintNormalAng;
218 torqueAxis1 = rel_pos2.
cross(constraintNormalLin);
228 torqueAxis1 = constraintNormalAng;
232 torqueAxis1 = rel_pos2.
cross(constraintNormalLin);
253 for (
int i = 0; i < ndofA; ++i)
275 const int ndofB = multiBodyB->
getNumDofs() + 6;
278 for (
int i = 0; i < ndofB; ++i)
312 btScalar penetration = isFriction ? 0 : posError;
323 for (
int i = 0; i < ndofA; ++i)
335 for (
int i = 0; i < ndofB; ++i)
352 btScalar velocityError = (desiredVelocity - rel_vel) * damping;
359 erp = infoGlobal.
m_erp;
362 positionalError = -penetration * erp / infoGlobal.
m_timeStep;
372 solverConstraint.
m_rhs = penetrationImpulse + velocityImpulse;
383 solverConstraint.
m_cfm = 0.f;
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
const T & at(int n) const
btAlignedObjectArray< btScalar > m_data
void updateJacobianSizes()
btMultiBodyConstraint(btMultiBody *bodyA, btMultiBody *bodyB, int linkA, int linkB, int numRows, bool isUnilateral, int type)
void applyDeltaVee(btMultiBodyJacobianData &data, btScalar *delta_vee, btScalar impulse, int velocityIndex, int ndof)
void allocateJacobiansMultiDof()
virtual ~btMultiBodyConstraint()
btScalar fillMultiBodyConstraint(btMultiBodySolverConstraint &solverConstraint, btMultiBodyJacobianData &data, btScalar *jacOrgA, btScalar *jacOrgB, const btVector3 &constraintNormalAng, const btVector3 &constraintNormalLin, const btVector3 &posAworld, const btVector3 &posBworld, btScalar posError, const btContactSolverInfo &infoGlobal, btScalar lowerLimit, btScalar upperLimit, bool angConstraint=false, btScalar relaxation=1.f, bool isFriction=false, btScalar desiredVelocity=0, btScalar cfmSlip=0, btScalar damping=1.0)
const btVector3 & getBasePos() const
int getCompanionId() const
const btMultibodyLink & getLink(int index) const
void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v) const
stepVelocitiesMultiDof is deprecated, use computeAccelerationsArticulatedBodyAlgorithmMultiDof instea...
void fillConstraintJacobianMultiDof(int link, const btVector3 &contact_point, const btVector3 &normal_ang, const btVector3 &normal_lin, btScalar *jac, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m) const
void setCompanionId(int id)
const btScalar * getVelocityVector() const
The btRigidBody is the main class for rigid body objects.
btScalar getInvMass() const
const btVector3 & getAngularVelocity() const
const btVector3 & getAngularFactor() const
const btMatrix3x3 & getInvInertiaTensorWorld() const
const btVector3 & getLinearVelocity() const
btVector3 can be used to represent 3D points and vectors.
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.
btAlignedObjectArray< btScalar > m_deltaVelocitiesUnitImpulse
btAlignedObjectArray< btScalar > m_deltaVelocities
btAlignedObjectArray< btScalar > m_jacobians
btAlignedObjectArray< btSolverBody > * m_solverBodyPool
btAlignedObjectArray< btScalar > scratch_r
btAlignedObjectArray< btMatrix3x3 > scratch_m
btAlignedObjectArray< btVector3 > scratch_v
1D constraint along a normal axis between bodyA and bodyB. It can be combined to solve contact and fr...
btVector3 m_relpos1CrossNormal
btVector3 m_contactNormal2
btVector3 m_contactNormal1
btMultiBody * m_multiBodyB
btVector3 m_angularComponentA
btVector3 m_relpos2CrossNormal
btSimdScalar m_appliedImpulse
btSimdScalar m_appliedPushImpulse
btScalar m_rhsPenetration
btMultiBody * m_multiBodyA
btVector3 m_angularComponentB
btTransform m_cachedWorldTransform
The btSolverBody is an internal datastructure for the constraint solver. Only necessary data is packe...
btRigidBody * m_originalBody
const btTransform & getWorldTransform() const