Changeset 10033 for code/branches/modularships/src/orxonox
- Timestamp:
- Apr 16, 2014, 8:59:17 PM (11 years ago)
- Location:
- code/branches/modularships/src/orxonox
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/modularships/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r10003 r10033 138 138 if (this->attachedShapes_.find(shape) != this->attachedShapes_.end()) 139 139 { 140 orxout() << "Still going..." << endl; 140 141 this->attachedShapes_.erase(shape); 141 142 if (shape->getCollisionShape()) 142 143 this->compoundShape_->removeChildShape(shape->getCollisionShape()); // TODO: Apparently this is broken? 143 144 shape->notifyDetached(); 145 orxout() << "Still going...." << endl; 144 146 145 147 this->updatePublicShape(); 148 orxout() << "Still going....." << endl; 146 149 } 147 150 else -
code/branches/modularships/src/orxonox/items/ShipPart.cc
r10023 r10033 89 89 { 90 90 this->parent_->removeShipPart(this); 91 orxout() << this->getName() << " has died." << endl; 91 92 } 92 93 -
code/branches/modularships/src/orxonox/worldentities/WorldEntity.cc
r10003 r10033 580 580 { 581 581 // Note: The collision shapes may not be detached with this function! 582 orxout() << "WE: detachCS()" << endl; 582 583 this->collisionShape_->detach(shape); 583 584 // Note: this->collisionShape_ already notifies us of any changes. -
code/branches/modularships/src/orxonox/worldentities/WorldEntity.h
r10029 r10033 72 72 { 73 73 friend class Scene; 74 friend class ModularSpaceShip; 74 75 75 76 public: -
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10029 r10033 40 40 #include "items/ShipPart.h" 41 41 #include "worldentities/StaticEntity.h" 42 #include "collisionshapes/WorldEntityCollisionShape.h" 42 43 #include <BulletCollision/CollisionShapes/btCollisionShape.h> 43 44 … … 78 79 { 79 80 // iterate through all attached objects 80 for (unsigned int i=0; i < this->getNumAttachedObj(); i++)81 for (unsigned int i=0; i < (unsigned int)(this->getNumAttachedObj()); i++) 81 82 { 82 83 if (this->getAttachedObject(i) == NULL) … … 179 180 //orxout() << "ShipPart of Entity " << cs->getUserPointer() << ": " << this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) << endl; 180 181 182 orxout() << "CP before handleHit" << endl; 183 181 184 if (this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL) 182 185 this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator); … … 276 279 if (itt->second == part) 277 280 { 278 //this->detach(itt->first);281 this->detach(itt->first); 279 282 //itt->first->destroy(); 280 itt->first->setActive(false); 281 itt->first->setVisible(false); 282 itt->first->setCollisionResponse(false); 283 //itt->first->setActive(false); 284 //itt->first->setVisible(false); 285 //itt->first->setCollisionResponse(false); 286 //itt->first->setCollisionType(None); 287 //itt->first->deactivatePhysics(); 283 288 this->partMap_.erase(itt); 284 289 } … … 286 291 } 287 292 293 /** 294 @brief 295 Detaches a child WorldEntity from this instance. 296 */ 297 void ModularSpaceShip::detach(WorldEntity* object) 298 { 299 std::set<WorldEntity*>::iterator it = this->children_.find(object); 300 if (it == this->children_.end()) 301 { 302 orxout(internal_warning) << "Cannot detach an object that is not a child." << endl; 303 return; 304 } 305 306 // collision shapes 307 orxout() << "MSS: detach()" << endl; 308 309 this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0); 310 this->detachCollisionShape(object->collisionShape_); // after succeeding, causes a crash in the collision handling 311 this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0); 312 313 // mass 314 if (object->getMass() > 0.0f) 315 { 316 this->childrenMass_ -= object->getMass(); 317 recalculateMassProps(); 318 } 319 320 this->detachNode(object->node_); 321 this->children_.erase(it); // this causes a crash when unloading the level. Or not? 322 323 object->notifyDetached(); 324 orxout() << "MSS: detach() completed." << endl; 325 } 288 326 } -
code/branches/modularships/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10023 r10033 118 118 void removeShipPart(ShipPart* part); 119 119 120 void detach(WorldEntity* object); 121 120 122 virtual void updatePartAssignment(); 121 123
Note: See TracChangeset
for help on using the changeset viewer.