Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 12, 2008, 4:17:02 PM (16 years ago)
Author:
martisty
Message:

loading objects and creating shapes…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/physics/src/orxonox/objects/worldentities/WorldEntity.cc

    r2192 r2201  
    148148    }
    149149
     150    void WorldEntitiy::attachPhysicalObject(WorldEntity* object){
     151    //function attachhysicalObject
     152        StaticEntity* staticObject = dynamic_cast<WorldEntity*>(object);
     153        if (staticObject != 0 && hasPhysics()){
     154           btCompountShape* compoundShape = dynamic_cast<btCompoundShape*>(physicalBody_->getCollisionShape());
     155           if(compoundShape == 0){
     156                //NEW
     157                btCompoundShape* newShape = new btCompoundShape();
     158                newShape->addChildShape(this->physcialBody_->getCollisionShape());
     159                newShape->addChildShape(staticObject->getCollisionShape());
     160                this->physicalBody_->setCollisionShape();
     161           }
     162           else{
     163               compoundShape -> addChildShape(staticObject->getCollisionShape());
     164           }
     165        }
     166    }
     167
    150168    void WorldEntity::detach(WorldEntity* object)
    151169    {
Note: See TracChangeset for help on using the changeset viewer.