Changeset 10216 for code/trunk/src/orxonox/worldentities
- Timestamp:
- Jan 31, 2015, 6:03:17 PM (10 years ago)
- Location:
- code/trunk
- Files:
-
- 9 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/worldentities/MovableEntity.cc
r9667 r10216 72 72 } 73 73 74 bool MovableEntity::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)74 bool MovableEntity::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 75 75 { 76 76 if (GameMode::isMaster() && enableCollisionDamage_) … … 80 80 { 81 81 float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length(); 82 victim->hit(0, contactPoint, damage);82 victim->hit(0, contactPoint, ownCollisionShape, damage); 83 83 } 84 84 } … … 86 86 return false; 87 87 } 88 89 88 90 89 void MovableEntity::registerVariables() -
code/trunk/src/orxonox/worldentities/MovableEntity.h
r9667 r10216 47 47 48 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint); 50 50 51 51 using WorldEntity::setPosition; -
code/trunk/src/orxonox/worldentities/WorldEntity.h
r9667 r10216 374 374 Condition is that enableCollisionCallback() was called. 375 375 */ 376 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)376 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 377 377 { return false; } /* With false, Bullet assumes no modification to the collision objects. */ 378 378 -
code/trunk/src/orxonox/worldentities/pawns/CMakeLists.txt
r7163 r10216 4 4 Pawn.cc 5 5 SpaceShip.cc 6 ModularSpaceShip.cc 6 7 TeamBaseMatchBase.cc 7 8 Destroyer.cc -
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r9950 r10216 244 244 } 245 245 246 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator )246 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 247 247 { 248 248 // Applies multiplier given by the DamageBoost Pickup. … … 279 279 280 280 */ 281 void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)281 void Pawn::hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage) 282 282 { 283 283 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 284 284 { 285 this->damage(damage, healthdamage, shielddamage, originator );285 this->damage(damage, healthdamage, shielddamage, originator, cs); 286 286 this->setVelocity(this->getVelocity() + force); 287 287 } 288 288 } 289 289 290 291 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) 290 void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage, float shielddamage) 292 291 { 293 292 if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) ) 294 293 { 295 this->damage(damage, healthdamage, shielddamage, originator );294 this->damage(damage, healthdamage, shielddamage, originator, cs); 296 295 297 296 if ( this->getController() ) … … 559 558 return BLANKSTRING; 560 559 } 561 562 563 560 } -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r9948 r10216 126 126 //virtual void hit(Pawn* originator, const Vector3& force, float damage); 127 127 //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage); 128 virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);129 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);128 virtual void hit(Pawn* originator, const Vector3& force, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); 129 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, const btCollisionShape* cs, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f); 130 130 131 131 virtual void kill(); … … 196 196 197 197 //virtual void damage(float damage, Pawn* originator = 0); 198 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL );198 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL); 199 199 200 200 bool bAlive_; -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
r9667 r10216 342 342 /** 343 343 @brief 344 Looks for an attached Engine with a certain name. 345 @param name 346 The name of the engine to be returned. 347 @return 348 Pointer to the engine with the given name, or NULL if not found. 349 */ 350 Engine* SpaceShip::getEngineByName(const std::string& name) 351 { 352 for(size_t i = 0; i < this->engineList_.size(); ++i) 353 if(this->engineList_[i]->getName() == name) 354 return this->engineList_[i]; 355 356 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; 357 return NULL; 358 } 359 360 /** 361 @brief 344 362 Remove and destroy all Engines of the SpaceShip. 345 363 */ … … 355 373 @param engine 356 374 A pointer to the Engine to be removed. 375 @note 376 Don't forget to reset the Engine's ship pointer after it was removed (or destroy the engine). 357 377 */ 358 378 void SpaceShip::removeEngine(Engine* engine) -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
r9667 r10216 124 124 bool hasEngine(Engine* engine) const; // Check whether the SpaceShip has a particular Engine. 125 125 Engine* getEngine(unsigned int i); // Get the i-th Engine of the SpaceShip. 126 Engine* getEngineByName(const std::string& name); 126 127 /** 127 128 @brief Get the list of all Engines that are mounted on the SpaceShip.
Note: See TracChangeset
for help on using the changeset viewer.