mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-10-21 00:01:00 +00:00
fix the bug where forces are ignore at a static/kinematic link while one of its ancesters is not.
This commit is contained in:
@@ -898,7 +898,7 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar
|
||||
|
||||
// calculate zhat_i^A
|
||||
//
|
||||
if (isLinkStaticOrKinematic(i))
|
||||
if (isLinkAndAllAncestorsStaticOrKinematic(i))
|
||||
{
|
||||
zeroAccSpatFrc[i].setZero();
|
||||
}
|
||||
@@ -967,7 +967,7 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar
|
||||
// (part of TreeForwardDynamics in Mirtich.)
|
||||
for (int i = num_links - 1; i >= 0; --i)
|
||||
{
|
||||
if(isLinkStaticOrKinematic(i))
|
||||
if(isLinkAndAllAncestorsStaticOrKinematic(i))
|
||||
continue;
|
||||
const int parent = m_links[i].m_parent;
|
||||
fromParent.m_rotMat = rot_from_parent[i + 1];
|
||||
@@ -2419,3 +2419,14 @@ bool btMultiBody::isLinkStaticOrKinematic(const int i) const
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool btMultiBody::isLinkAndAllAncestorsStaticOrKinematic(const int i) const
|
||||
{
|
||||
int link = i;
|
||||
while (link != -1) {
|
||||
if (!isLinkStaticOrKinematic(link))
|
||||
return false;
|
||||
link = m_links[link].m_parent;
|
||||
}
|
||||
return isBaseStaticOrKinematic();
|
||||
}
|
||||
|
||||
@@ -720,6 +720,8 @@ public:
|
||||
|
||||
bool isLinkStaticOrKinematic(const int i) const;
|
||||
|
||||
bool isLinkAndAllAncestorsStaticOrKinematic(const int i) const;
|
||||
|
||||
private:
|
||||
btMultiBody(const btMultiBody &); // not implemented
|
||||
void operator=(const btMultiBody &); // not implemented
|
||||
|
||||
Reference in New Issue
Block a user