Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2011, 11:26:08 PM (13 years ago)
Author:
dafrick
Message:

Some cleanup. Ready for merge.

Location:
code/branches/pickup/src/orxonox
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc

    r8422 r8554  
    261261        CollisionShape::changedScale();
    262262
    263         // Iterate through all attached CollisionShapes.
     263        std::vector<CollisionShape*> shapes;
     264        // Iterate through all attached CollisionShapes and add them to the list of shapes.
     265        for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
     266            shapes.push_back(it->first);
     267
     268        // Delete the compound shape and create a new one.
     269        delete this->compoundShape_;
     270        this->compoundShape_ = new btCompoundShape();
     271
     272        // Re-attach all CollisionShapes.
     273        for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
     274        {
     275            CollisionShape* shape = *it;
     276            shape->setScale3D(this->getScale3D());
     277            // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
     278            if (shape->getCollisionShape())
     279            {
     280                btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
     281                // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape.
     282                this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
     283            }
     284        }
     285
     286        this->updatePublicShape();
     287
     288        /*
     289        // Iterate through all attached CollisionShapes
    264290        for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
    265291        {
     
    269295        }
    270296
    271         this->updatePublicShape();
     297        this->updatePublicShape();*/
    272298    }
    273299}
  • code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h

    r8422 r8554  
    5252        Reto Grieder
    5353
     54    @see btCompoundShape
    5455    @ingroup Collisionshapes
    5556    */
  • code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc

    r8422 r8554  
    643643    {
    644644        // If physics is enabled scale the attached CollisionShape.
    645         if (false && this->hasPhysics() && this->collisionShape_ != NULL)
     645        /*if (this->hasPhysics() && this->collisionShape_ != NULL)
    646646        {
    647647            this->collisionShape_->setScale3D(scale);
    648         }
     648        }*/
    649649
    650650        this->node_->setScale(scale);
Note: See TracChangeset for help on using the changeset viewer.