Changeset 2562 for code/branches/presentation/src/orxonox/objects/collisionshapes/CompoundCollisionShape.cc
- Timestamp:
- Jan 1, 2009, 7:34:44 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/orxonox/objects/collisionshapes/CompoundCollisionShape.cc
r2527 r2562 36 36 #include "core/XMLPort.h" 37 37 #include "tools/BulletConversions.h" 38 #include "objects/worldentities/WorldEntity.h"39 38 40 39 namespace orxonox … … 47 46 48 47 this->compoundShape_ = new btCompoundShape(); 49 this->worldEntityParent_ = 0;50 48 } 51 49 … … 59 57 { 60 58 // make sure that the child doesn't want to detach itself --> speedup because of the missing update 61 it->first-> setParent(0, OBJECTID_UNKNOWN);59 it->first->notifyDetached(); 62 60 delete it->first; 63 61 } … … 74 72 } 75 73 76 void CompoundCollisionShape::setWorldEntityParent(WorldEntity* parent)77 {78 // suppress synchronisation79 this->setObjectMode(0x0);80 81 this->worldEntityParent_ = parent;82 }83 84 74 void CompoundCollisionShape::attach(CollisionShape* shape) 85 75 { … … 91 81 return; 92 82 } 83 84 if (!shape->notifyBeingAttached(this)) 85 return; 86 93 87 this->attachedShapes_[shape] = shape->getCollisionShape(); 94 88 … … 101 95 this->updatePublicShape(); 102 96 } 103 104 // network synchro105 if (this->worldEntityParent_)106 {107 // This compound collision shape belongs to a WE and doesn't get synchronised108 // So set our parent to be the WE109 shape->setParent(this, this->worldEntityParent_->getObjectID());110 }111 else112 shape->setParent(this, this->getObjectID());113 97 } 114 98 … … 117 101 if (this->attachedShapes_.find(shape) != this->attachedShapes_.end()) 118 102 { 119 shape->setParent(0, OBJECTID_UNKNOWN);120 103 this->attachedShapes_.erase(shape); 121 104 if (shape->getCollisionShape()) 122 105 this->compoundShape_->removeChildShape(shape->getCollisionShape()); 106 shape->notifyDetached(); 123 107 124 108 this->updatePublicShape(); … … 197 181 } 198 182 199 void CompoundCollisionShape::updateParent()200 {201 if (this->parent_)202 this->parent_->updateAttachedShape(this);203 if (this->worldEntityParent_)204 this->worldEntityParent_->notifyCollisionShapeChanged();205 }206 207 void CompoundCollisionShape::parentChanged()208 {209 if (!this->worldEntityParent_)210 CollisionShape::parentChanged();211 }212 213 183 CollisionShape* CompoundCollisionShape::getAttachedShape(unsigned int index) const 214 184 {
Note: See TracChangeset
for help on using the changeset viewer.