Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 21, 2011, 6:58:23 PM (14 years ago)
Author:
rgrieder
Message:

Merged revisions 7978 - 8096 from kicklib to kicklib2.

Location:
code/branches/kicklib2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib2

  • code/branches/kicklib2/src/external/bullet/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp

    r5781 r8284  
    115115        void    ProcessChildShape(btCollisionShape* childShape,int index)
    116116        {
    117                
     117                btAssert(index>=0);
    118118                btCompoundShape* compoundShape = static_cast<btCompoundShape*>(m_compoundColObj->getCollisionShape());
     119                btAssert(index<compoundShape->getNumChildShapes());
    119120
    120121
     
    142143                        if (!m_childCollisionAlgorithms[index])
    143144                                m_childCollisionAlgorithms[index] = m_dispatcher->findAlgorithm(m_compoundColObj,m_otherObj,m_sharedManifold);
     145
     146                        ///detect swapping case
     147                        if (m_resultOut->getBody0Internal() == m_compoundColObj)
     148                        {
     149                                m_resultOut->setShapeIdentifiersA(-1,index);
     150                        } else
     151                        {
     152                                m_resultOut->setShapeIdentifiersB(-1,index);
     153                        }
    144154
    145155                        m_childCollisionAlgorithms[index]->processCollision(m_compoundColObj,m_otherObj,m_dispatchInfo,m_resultOut);
     
    258268                int i;
    259269                btManifoldArray manifoldArray;
    260 
     270        btCollisionShape* childShape = 0;
     271        btTransform     orgTrans;
     272        btTransform     orgInterpolationTrans;
     273        btTransform     newChildWorldTrans;
     274        btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;       
     275       
    261276                for (i=0;i<numChildren;i++)
    262277                {
    263278                        if (m_childCollisionAlgorithms[i])
    264279                        {
    265                                 btCollisionShape* childShape = compoundShape->getChildShape(i);
     280                                childShape = compoundShape->getChildShape(i);
    266281                        //if not longer overlapping, remove the algorithm
    267                                 btTransform     orgTrans = colObj->getWorldTransform();
    268                                 btTransform     orgInterpolationTrans = colObj->getInterpolationWorldTransform();
     282                orgTrans = colObj->getWorldTransform();
     283                orgInterpolationTrans = colObj->getInterpolationWorldTransform();
    269284                                const btTransform& childTrans = compoundShape->getChildTransform(i);
    270                                 btTransform     newChildWorldTrans = orgTrans*childTrans ;
     285                newChildWorldTrans = orgTrans*childTrans ;
    271286
    272287                                //perform an AABB check first
    273                                 btVector3 aabbMin0,aabbMax0,aabbMin1,aabbMax1;
    274288                                childShape->getAabb(newChildWorldTrans,aabbMin0,aabbMax0);
    275289                                otherObj->getCollisionShape()->getAabb(otherObj->getWorldTransform(),aabbMin1,aabbMax1);
     
    281295                                        m_childCollisionAlgorithms[i] = 0;
    282296                                }
    283 
    284297                        }
    285                        
    286                 }
    287 
    288                
    289 
     298                }
    290299        }
    291300}
     
    312321        int numChildren = m_childCollisionAlgorithms.size();
    313322        int i;
     323    btTransform orgTrans;
     324    btScalar frac;
    314325        for (i=0;i<numChildren;i++)
    315326        {
     
    318329
    319330                //backup
    320                 btTransform     orgTrans = colObj->getWorldTransform();
     331        orgTrans = colObj->getWorldTransform();
    321332       
    322333                const btTransform& childTrans = compoundShape->getChildTransform(i);
     
    326337                btCollisionShape* tmpShape = colObj->getCollisionShape();
    327338                colObj->internalSetTemporaryCollisionShape( childShape );
    328                 btScalar frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);
     339        frac = m_childCollisionAlgorithms[i]->calculateTimeOfImpact(colObj,otherObj,dispatchInfo,resultOut);
    329340                if (frac<hitFraction)
    330341                {
Note: See TracChangeset for help on using the changeset viewer.