Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 8, 2009, 12:58:47 AM (16 years ago)
Author:
dafrick
Message:

Reverted to revision 2906 (because I'm too stupid to merge correctly, 2nd try will follow shortly. ;))

Location:
code/branches/questsystem5
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/questsystem5

  • code/branches/questsystem5/src/bullet/BulletCollision/CollisionShapes/btCompoundShape.cpp

    r2907 r2908  
    2323m_collisionMargin(btScalar(0.)),
    2424m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
    25 m_dynamicAabbTree(0),
    26 m_updateRevision(1)
     25m_dynamicAabbTree(0)
    2726{
    2827        m_shapeType = COMPOUND_SHAPE_PROXYTYPE;
     
    4847void    btCompoundShape::addChildShape(const btTransform& localTransform,btCollisionShape* shape)
    4948{
    50         m_updateRevision++;
    5149        //m_childTransforms.push_back(localTransform);
    5250        //m_childShapes.push_back(shape);
     
    5755        child.m_childMargin = shape->getMargin();
    5856
    59        
     57        m_children.push_back(child);
     58
    6059        //extend the local aabbMin/aabbMax
    6160        btVector3 localAabbMin,localAabbMax;
     
    7675        {
    7776                const btDbvtVolume      bounds=btDbvtVolume::FromMM(localAabbMin,localAabbMax);
    78                 int index = m_children.size();
     77                int index = m_children.size()-1;
    7978                child.m_node = m_dynamicAabbTree->insert(bounds,(void*)index);
    8079        }
    81 
    82         m_children.push_back(child);
    8380
    8481}
     
    103100void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
    104101{
    105         m_updateRevision++;
    106102        btAssert(childShapeIndex >=0 && childShapeIndex < m_children.size());
    107103        if (m_dynamicAabbTree)
     
    118114void btCompoundShape::removeChildShape(btCollisionShape* shape)
    119115{
    120         m_updateRevision++;
    121116        // Find the children containing the shape specified, and remove those children.
    122117        //note: there might be multiple children using the same shape!
     
    145140        // Recalculate the local aabb
    146141        // Brute force, it iterates over all the shapes left.
    147 
    148142        m_localAabbMin = btVector3(btScalar(1e30),btScalar(1e30),btScalar(1e30));
    149143        m_localAabbMax = btVector3(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
     
    168162{
    169163        btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
     164        localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
    170165        btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
    171        
    172         //avoid an illegal AABB when there are no children
    173         if (!m_children.size())
    174         {
    175                 localHalfExtents.setValue(0,0,0);
    176                 localCenter.setValue(0,0,0);
    177         }
    178         localHalfExtents += btVector3(getMargin(),getMargin(),getMargin());
    179                
    180166
    181167        btMatrix3x3 abs_b = trans.getBasis().absolute(); 
     
    188174        aabbMin = center-extent;
    189175        aabbMax = center+extent;
    190        
     176
    191177}
    192178
Note: See TracChangeset for help on using the changeset viewer.