56 for (
int k = 0; k < ndof; ++k)
58 vel += (local_v[k] + local_dv[k]) * J_n[k];
63 for (
int k = 0; k < ndof; ++k)
65 vel += (local_v[k] + local_dv[k]) * J_t1[k];
69 for (
int k = 0; k < ndof; ++k)
71 vel += (local_v[k] + local_dv[k]) * J_t2[k];
108 if (multibodyLinkCol)
120 return residualSquare;
147 : m_contact(other.m_contact),
btDeformableContactConstraint(other), m_penetration(other.m_penetration), m_total_split_impulse(other.m_total_split_impulse), m_binding(other.m_binding)
171 if (multibodyLinkCol)
181 for (
int k = 0; k < ndof; ++k)
183 vel += (local_v[k] + local_dv[k]) * J_n[k];
188 for (
int k = 0; k < ndof; ++k)
190 vel += (local_v[k] + local_dv[k]) * J_t1[k];
194 for (
int k = 0; k < ndof; ++k)
196 vel += (local_v[k] + local_dv[k]) * J_t2[k];
223 if (multibodyLinkCol)
232 for (
int k = 0; k < ndof; ++k)
234 vel += local_split_v[k] * J_n[k];
239 for (
int k = 0; k < ndof; ++k)
241 vel += local_split_v[k] * J_t1[k];
245 for (
int k = 0; k < ndof; ++k)
247 vel += local_split_v[k] * J_t2[k];
278 btVector3 impulse_tangent = impulse - impulse_normal;
321 impulse = impulse_normal + impulse_tangent;
338 if (multibodyLinkCol)
353 return residualSquare;
401 if (multibodyLinkCol)
408 return residualSquare;
505 btScalar m01 = (relaxation / (im0 + im1));
506 btScalar m02 = (relaxation / (im0 + im2));
507 btScalar m12 = (relaxation / (im1 + im2));
508#ifdef USE_STRAIN_RATE_LIMITING
514 const btVector3 x_diff[3] = {x1 - x0, x2 - x0, x2 - x1};
515 const btVector3 v_diff[3] = {v1 - v0, v2 - v0, v2 - v1};
519 for (
int i = 0; i < 3; ++i)
522 btScalar x_diff_norm_new = (x_diff[i] + v_diff[i] * dt).safeNorm();
523 btScalar strainRate = x_diff_norm_new / x_diff_norm;
526 if (x_diff_norm == 0 || (1 - p <= strainRate && strainRate <= 1 + p))
531 x_diff_dot_u =
btDot(x_diff[i], u[i]);
533 if (1 - p > strainRate)
535 s = 1 / dt * (-x_diff_dot_u -
btSqrt(x_diff_dot_u * x_diff_dot_u + (p * p - 2 * p) * x_diff_norm * x_diff_norm));
539 s = 1 / dt * (-x_diff_dot_u +
btSqrt(x_diff_dot_u * x_diff_dot_u + (p * p + 2 * p) * x_diff_norm * x_diff_norm));
545 btVector3 dv0 = im0 * (m01 * u[0] * (-dn[0]) + m02 * u[1] * -(dn[1]));
546 btVector3 dv1 = im1 * (m01 * u[0] * (dn[0]) + m12 * u[2] * (-dn[2]));
547 btVector3 dv2 = im2 * (m12 * u[2] * (dn[2]) + m02 * u[1] * (dn[1]));
550 btVector3 dv0 = im0 * (m01 * (v1 - v0) + m02 * (v2 - v0));
551 btVector3 dv1 = im1 * (m01 * (v0 - v1) + m12 * (v2 - v1));
552 btVector3 dv2 = im2 * (m12 * (v1 - v2) + m02 * (v0 - v2));
640 btVector3 impulse_tangent = impulse - impulse_normal;
685 impulse = impulse_normal + impulse_tangent;
688 return residualSquare;
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btSqrt(btScalar y)
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
int getInternalType() const
reserved for Bullet internal usage
bool hasContactResponse() const
btMatrix3x3 inverse() const
Return the inverse of the matrix.
static btMultiBodyLinkCollider * upcast(btCollisionObject *colObj)
btMultiBody * m_multiBody
void applyDeltaSplitVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
const btScalar * getDeltaVelocityVector() const
const btScalar * getSplitVelocityVector() const
void applyDeltaVeeMultiDof2(const btScalar *delta_vee, btScalar multiplier)
const btScalar * getVelocityVector() const
The btRigidBody is the main class for rigid body objects.
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
btVector3 getPushVelocityInLocalPoint(const btVector3 &rel_pos) const
void applyPushImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
btMultiBodyJacobianData jacobianData_t1
btMultiBodyJacobianData jacobianData_normal
btMultiBodyJacobianData jacobianData_t2
btVector3 can be used to represent 3D points and vectors.
btScalar safeNorm() const
Return the norm (length) of the vector.
btVector3 & safeNormalize()
btScalar dot(const btVector3 &v) const
Return the dot product.
btScalar norm() const
Return the norm (length) of the vector.
btVector3 normalized() const
Return a normalized version of this vector.
btAlignedObjectArray< btScalar > m_deltaVelocitiesUnitImpulse
btAlignedObjectArray< btScalar > m_jacobians
const btCollisionObject * m_colObj