constraint solver: fix bug in getOrInitSolverBody (threadsafe case only) for kinematic objects
This commit is contained in:
@@ -738,20 +738,12 @@ int btSequentialImpulseConstraintSolver::getOrInitSolverBody(btCollisionObject&
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( body.isStaticObject() )
|
else if (body.isKinematicObject())
|
||||||
{
|
{
|
||||||
// all fixed bodies (inf mass) get mapped to a single solver id
|
//
|
||||||
if ( m_fixedBodyId < 0 )
|
// NOTE: must test for kinematic before static because some kinematic objects also
|
||||||
{
|
// identify as "static"
|
||||||
m_fixedBodyId = m_tmpSolverBodyPool.size();
|
//
|
||||||
btSolverBody& fixedBody = m_tmpSolverBodyPool.expand();
|
|
||||||
initSolverBody( &fixedBody, 0, timeStep );
|
|
||||||
}
|
|
||||||
solverBodyId = m_fixedBodyId;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// kinematic
|
|
||||||
// Kinematic bodies can be in multiple islands at once, so it is a
|
// Kinematic bodies can be in multiple islands at once, so it is a
|
||||||
// race condition to write to them, so we use an alternate method
|
// race condition to write to them, so we use an alternate method
|
||||||
// to record the solverBodyId
|
// to record the solverBodyId
|
||||||
@@ -773,6 +765,17 @@ int btSequentialImpulseConstraintSolver::getOrInitSolverBody(btCollisionObject&
|
|||||||
m_kinematicBodyUniqueIdToSolverBodyTable[ uniqueId ] = solverBodyId;
|
m_kinematicBodyUniqueIdToSolverBodyTable[ uniqueId ] = solverBodyId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// all fixed bodies (inf mass) get mapped to a single solver id
|
||||||
|
if ( m_fixedBodyId < 0 )
|
||||||
|
{
|
||||||
|
m_fixedBodyId = m_tmpSolverBodyPool.size();
|
||||||
|
btSolverBody& fixedBody = m_tmpSolverBodyPool.expand();
|
||||||
|
initSolverBody( &fixedBody, 0, timeStep );
|
||||||
|
}
|
||||||
|
solverBodyId = m_fixedBodyId;
|
||||||
|
}
|
||||||
btAssert( solverBodyId < m_tmpSolverBodyPool.size() );
|
btAssert( solverBodyId < m_tmpSolverBodyPool.size() );
|
||||||
return solverBodyId;
|
return solverBodyId;
|
||||||
#else // BT_THREADSAFE
|
#else // BT_THREADSAFE
|
||||||
|
|||||||
Reference in New Issue
Block a user