more compounds work, the basics work. now some stackless tree-tree traversal is needed to speedup compound versus compound.
This commit is contained in:
@@ -25,6 +25,7 @@ CollisionObject::CollisionObject()
|
||||
m_ccdSweptShereRadius(0.f),
|
||||
m_ccdSquareMotionTreshold(0.f)
|
||||
{
|
||||
m_cachedInvertedWorldTransform.setIdentity();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,9 @@ struct CollisionObject
|
||||
//m_interpolationWorldTransform is used for CCD and interpolation
|
||||
//it can be either previous or future (predicted) transform
|
||||
SimdTransform m_interpolationWorldTransform;
|
||||
|
||||
|
||||
SimdTransform m_cachedInvertedWorldTransform;
|
||||
|
||||
enum CollisionFlags
|
||||
{
|
||||
isStatic = 1,
|
||||
|
||||
@@ -72,11 +72,20 @@ void CompoundCollisionAlgorithm::ProcessCollision (BroadphaseProxy* ,BroadphaseP
|
||||
//temporarily exchange parent CollisionShape with childShape, and recurse
|
||||
CollisionShape* childShape = compoundShape->GetChildShape(i);
|
||||
CollisionObject* colObj = static_cast<CollisionObject*>(m_childProxies[i].m_clientObject);
|
||||
|
||||
//backup
|
||||
SimdTransform orgTrans = colObj->m_worldTransform;
|
||||
CollisionShape* orgShape = colObj->m_collisionShape;
|
||||
|
||||
SimdTransform childTrans = compoundShape->GetChildTransform(i);
|
||||
SimdTransform newChildWorldTrans = orgTrans*childTrans ;
|
||||
colObj->m_worldTransform = newChildWorldTrans;
|
||||
|
||||
colObj->m_collisionShape = childShape;
|
||||
m_childCollisionAlgorithms[i]->ProcessCollision(&m_childProxies[i],&m_otherProxy,dispatchInfo);
|
||||
//revert back
|
||||
colObj->m_collisionShape =orgShape;
|
||||
colObj->m_worldTransform = orgTrans;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,12 @@ void ManifoldResult::AddContactPoint(const SimdVector3& normalOnBInWorld,const S
|
||||
if (depth > m_manifoldPtr->GetContactBreakingTreshold())
|
||||
return;
|
||||
|
||||
SimdTransform transAInv = m_body0->m_worldTransform.inverse();
|
||||
SimdTransform transBInv= m_body1->m_worldTransform.inverse();
|
||||
|
||||
SimdTransform transAInv = m_body0->m_cachedInvertedWorldTransform;
|
||||
SimdTransform transBInv= m_body1->m_cachedInvertedWorldTransform;
|
||||
|
||||
//transAInv = m_body0->m_worldTransform.inverse();
|
||||
//transBInv= m_body1->m_worldTransform.inverse();
|
||||
SimdVector3 pointA = pointInWorld + normalOnBInWorld * depth;
|
||||
SimdVector3 localA = transAInv(pointA );
|
||||
SimdVector3 localB = transBInv(pointInWorld);
|
||||
|
||||
@@ -113,6 +113,7 @@ void SimulationIslandManager::StoreIslandActivationState(CollisionWorld* colWorl
|
||||
//
|
||||
void SimulationIslandManager::BuildAndProcessIslands(Dispatcher* dispatcher,CollisionObjectArray& collisionObjects, IslandCallback* callback)
|
||||
{
|
||||
|
||||
int numBodies = collisionObjects.size();
|
||||
|
||||
for (int islandId=0;islandId<numBodies;islandId++)
|
||||
@@ -128,8 +129,10 @@ void SimulationIslandManager::BuildAndProcessIslands(Dispatcher* dispatcher,Coll
|
||||
for (i=0;i<numBodies;i++)
|
||||
{
|
||||
CollisionObject* colObj0 = collisionObjects[i];
|
||||
|
||||
if (colObj0->m_islandTag1 == islandId)
|
||||
{
|
||||
|
||||
if (colObj0->GetActivationState()== ACTIVE_TAG)
|
||||
{
|
||||
allSleeping = false;
|
||||
|
||||
@@ -77,6 +77,7 @@ void CompoundShape::CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia)
|
||||
{
|
||||
//approximation: take the inertia from the aabb for now
|
||||
SimdTransform ident;
|
||||
ident.setIdentity();
|
||||
SimdVector3 aabbMin,aabbMax;
|
||||
GetAabb(ident,aabbMin,aabbMax);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user