Changeset 10036
- Timestamp:
 - Apr 17, 2014, 3:41:17 PM (12 years ago)
 - Location:
 - code/branches/modularships/src/orxonox
 - Files:
 - 
          
- 4 edited
 
- 
          Scene.cc (modified) (2 diffs)
 - 
          collisionshapes/CompoundCollisionShape.cc (modified) (1 diff)
 - 
          worldentities/pawns/ModularSpaceShip.cc (modified) (2 diffs)
 - 
          worldentities/pawns/ModularSpaceShip.h (modified) (2 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
        
code/branches/modularships/src/orxonox/Scene.cc
r10011 r10036 345 345 int index0, const btCollisionObject* colObj1, int partId1, int index1) 346 346 { 347 orxout() << "collisionCb()" << endl; 348 347 349 // get the WorldEntity pointers 348 350 SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer()); … … 360 362 modified |= object1->collidesAgainst(object0, cs0, cp); 361 363 364 orxout() << "collisionCb() completed." << endl; 365 362 366 return modified; 363 367 }  - 
        
code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r10033 r10036 138 138 if (this->attachedShapes_.find(shape) != this->attachedShapes_.end()) 139 139 { 140 orxout() << "Still going..." << endl;141 140 this->attachedShapes_.erase(shape); 142 141 if (shape->getCollisionShape()) 143 142 this->compoundShape_->removeChildShape(shape->getCollisionShape()); // TODO: Apparently this is broken? 144 143 shape->notifyDetached(); 145 orxout() << "Still going...." << endl;146 144 147 145 this->updatePublicShape(); 148 orxout() << "Still going....." << endl;149 146 } 150 147 else  - 
        
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10033 r10036 42 42 #include "collisionshapes/WorldEntityCollisionShape.h" 43 43 #include <BulletCollision/CollisionShapes/btCollisionShape.h> 44 #include <BulletCollision/CollisionShapes/btCompoundShape.h> 44 45 45 46 … … 126 127 127 128 this->partMap_[entity] = part; 129 130 //This adds a list of SmartPointers for all StaticEntities which have a ShipPart, preventing them from getting deleted. Hopefully. 131 SmartPtr<StaticEntity> newSmartPtr = entity; 132 SmartPtr<StaticEntity>* one = &newSmartPtr; 133 this->entityPtrList_.push_back(one); 134 135 this->createCSPtrList(this->getWorldEntityCollisionShape()); 136 128 137 orxout() << "New entity-part assignment created!" << endl; 138 } 139 140 // This should add smartPointers to all (Orxonox)Collisionshapes of this SpaceShip, preventing them fromg etting deleted. Might not work due to weird acting getAttachedShape 141 void ModularSpaceShip::createCSPtrList(CompoundCollisionShape* cs) 142 { 143 for (int i=0; i < cs->getNumChildShapes(); i++) 144 { 145 146 if (!orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i))) 147 { 148 SmartPtr<CollisionShape> newSmartPtr = cs->getAttachedShape(i); 149 SmartPtr<CollisionShape>* one = &newSmartPtr; 150 this->csPtrList_.push_back(one); 151 } 152 153 if (orxonox_cast<CompoundCollisionShape*>(cs->getAttachedShape(i))) 154 createCSPtrList((CompoundCollisionShape*)(cs->getAttachedShape(i))); 155 156 } 129 157 } 130 158  - 
        
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10033 r10036 122 122 virtual void updatePartAssignment(); 123 123 124 void createCSPtrList(CompoundCollisionShape* cs); 125 124 126 protected: 125 127 … … 128 130 void registerVariables(); 129 131 std::vector<ShipPart*> partList_; // The list of all Parts mounted on this ModularSpaceShip. 132 std::vector<SmartPtr<StaticEntity>*> entityPtrList_; 133 std::vector<SmartPtr<CollisionShape>*> csPtrList_; 130 134 std::map<StaticEntity*, ShipPart*> partMap_; 131 135  
Note: See TracChangeset
          for help on using the changeset viewer.
      


            






