Changeset 10415
- Timestamp:
- May 3, 2015, 12:19:49 PM (10 years ago)
- Location:
- code/branches/core7/src/orxonox
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/src/orxonox/Scene.cc
r10347 r10415 67 67 this->debugDrawer_ = NULL; 68 68 this->soundReferenceDistance_ = 20.0; 69 this->bIsUpdatingPhysics_ = false; 69 70 70 71 if (GameMode::showsGraphics()) … … 266 267 // Note: 60 means that Bullet will do physics correctly down to 1 frames per seconds. 267 268 // Under that mark, the simulation will "loose time" and get unusable. 268 physicalWorld_->stepSimulation(dt, 60); 269 this->bIsUpdatingPhysics_ = true; 270 this->physicalWorld_->stepSimulation(dt, 60); 271 this->bIsUpdatingPhysics_ = false; 269 272 270 273 if (this->bDebugDrawPhysics_) 271 physicalWorld_->debugDrawWorld();274 this->physicalWorld_->debugDrawWorld(); 272 275 } 273 276 } -
code/branches/core7/src/orxonox/Scene.h
r10196 r10415 110 110 111 111 public: 112 inline bool hasPhysics() 112 inline bool hasPhysics() const 113 113 { return this->physicalWorld_ != 0; } 114 114 void setPhysicalWorld(bool wantsPhysics); … … 128 128 void addPhysicalObject(WorldEntity* object); 129 129 void removePhysicalObject(WorldEntity* object); 130 131 inline bool isUpdatingPhysics() const 132 { return this->bIsUpdatingPhysics_; } 130 133 131 134 void setDebugDrawPhysics(bool bDraw, bool bFill, float fillAlpha); … … 163 166 BulletDebugDrawer* debugDrawer_; 164 167 bool bDebugDrawPhysics_; 168 bool bIsUpdatingPhysics_; 165 169 }; 166 170 } -
code/branches/core7/src/orxonox/collisionshapes/CollisionShape.cc
r10362 r10415 41 41 #include "CompoundCollisionShape.h" 42 42 #include "WorldEntityCollisionShape.h" 43 #include "Scene.h" 43 44 44 45 namespace orxonox … … 74 75 { 75 76 // Detach from parent CompoundCollisionShape. 76 if (this->isInitialized() && this->parent_) 77 this->parent_->detach(this); 77 if (this->isInitialized()) 78 { 79 if (this->getScene() && this->getScene()->isUpdatingPhysics()) 80 orxout(internal_error) << "Don't destroy collision shapes while the physics is updated! This will lead to crashes" << endl; 81 82 if (this->parent_) 83 this->parent_->detach(this); 84 } 78 85 } 79 86
Note: See TracChangeset
for help on using the changeset viewer.