Changeset 10212
- Timestamp:
- Jan 31, 2015, 4:14:57 PM (10 years ago)
- Location:
- code/branches/presentationFS14/src/orxonox/worldentities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationFS14/src/orxonox/worldentities/WorldEntity.h
r10203 r10212 72 72 { 73 73 friend class Scene; 74 friend class ModularSpaceShip;75 74 76 75 public: … … 207 206 208 207 void notifyChildPropsChanged(); 209 210 inline int getNumAttachedObj()211 { return this->children_.size(); }212 208 213 209 protected: -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10211 r10212 42 42 #include "items/Engine.h" 43 43 #include "worldentities/StaticEntity.h" 44 #include "collisionshapes/WorldEntityCollisionShape.h"45 44 #include <BulletCollision/CollisionShapes/btCollisionShape.h> 46 45 #include <BulletCollision/CollisionShapes/btCompoundShape.h> … … 92 91 { 93 92 // iterate through all attached objects 94 for (unsigned int i=0; i < (unsigned int)(this->getNumAttachedObj()); i++)93 for (unsigned int i=0; i < this->getAttachedObjects().size(); i++) 95 94 { 96 95 if (this->getAttachedObject(i) == NULL) … … 313 312 } 314 313 } 315 316 /**317 @brief318 Detaches a child WorldEntity from this instance.319 */320 void ModularSpaceShip::detach(WorldEntity* object)321 {322 std::set<WorldEntity*>::iterator it = this->children_.find(object);323 if (it == this->children_.end())324 {325 orxout(internal_warning) << "Cannot detach an object that is not a child." << endl;326 return;327 }328 329 // collision shapes330 331 //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0);332 this->detachCollisionShape(object->collisionShape_); // after succeeding, causes a crash in the collision handling333 //this->printBtChildShapes((btCompoundShape*)(this->getWorldEntityCollisionShape()->getCollisionShape()), 2, 0);334 335 // mass336 if (object->getMass() > 0.0f)337 {338 this->childrenMass_ -= object->getMass();339 recalculateMassProps();340 }341 342 this->detachNode(object->node_);343 this->children_.erase(it); // this causes a crash when unloading the level. Or not?344 345 object->notifyDetached();346 }347 314 } -
code/branches/presentationFS14/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10211 r10212 127 127 { return this->rotationThrust_; } 128 128 129 void detach(WorldEntity* object);130 131 129 virtual void updatePartAssignment(); 132 130
Note: See TracChangeset
for help on using the changeset viewer.