Changeset 8554 for code/branches/pickup/src
- Timestamp:
- May 23, 2011, 11:26:08 PM (14 years ago)
- Location:
- code/branches/pickup/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup/src/libraries/util/SubString.h
r7401 r8554 169 169 /// Returns the number of tokens stored in this SubString 170 170 inline unsigned int size() const { return this->tokens_.size(); } 171 /// Returns the i'th token from the subset of strings @param index The index of the requested doken171 /// Returns the i'th token from the subset of strings @param index The index of the requested token 172 172 inline const std::string& operator[](unsigned int index) const { return this->tokens_[index]; } 173 173 /// Returns the i'th token from the subset of strings @param index The index of the requested token -
code/branches/pickup/src/modules/objects/collisionshapes/BoxCollisionShape.h
r8422 r8554 51 51 Reto Grieder 52 52 53 @see btBoxShape 53 54 @ingroup Collisionshapes 54 55 */ -
code/branches/pickup/src/modules/objects/collisionshapes/ConeCollisionShape.h
r8422 r8554 49 49 Reto Grieder 50 50 51 @ingroup Collisionshapes. 51 @see btConeShape 52 @ingroup Collisionshapes 52 53 */ 53 54 class _ObjectsExport ConeCollisionShape : public CollisionShape -
code/branches/pickup/src/modules/objects/collisionshapes/PlaneCollisionShape.h
r8422 r8554 51 51 Martin Stypinski 52 52 53 @see btStaticPlaneShape 53 54 @ingroup Collisionshapes 54 55 */ -
code/branches/pickup/src/modules/objects/collisionshapes/SphereCollisionShape.h
r8422 r8554 49 49 Reto Grieder 50 50 51 @see btSphereShape 51 52 @ingroup Collisionshapes 52 53 */ -
code/branches/pickup/src/modules/pickup/PickupPrereqs.h
r8255 r8554 82 82 class SpeedPickup; 83 83 class ShieldPickup; 84 84 class ShrinkPickup; 85 85 86 86 } -
code/branches/pickup/src/modules/pickup/items/ShrinkPickup.cc
r8535 r8554 51 51 CreateFactory(ShrinkPickup); 52 52 53 53 /** 54 54 @brief 55 55 Constructor: Initializes the Pickup. … … 60 60 61 61 this->initialize(); 62 this->shrinkFactor_ = 5.0; 63 this->shrinkSpeed_ = 5.0; 64 this->duration_ = 5.0; 62 65 isActive_ = false; 63 66 isTerminating_ = false; … … 92 95 /** 93 96 @brief 94 Method for creating a HealthPickup object through XML.97 Method for creating a ShrinkhPickup object through XML. 95 98 */ 96 99 void ShrinkPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) … … 143 146 } 144 147 145 148 /** 146 149 @brief 147 150 Prepares for shrinking (collecting several informations). … … 153 156 if(this->isUsed()) 154 157 { 155 this->pawn = this->carrierToPawnHelper();156 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.158 this->pawn_ = this->carrierToPawnHelper(); 159 if(pawn_ == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 157 160 this->Pickupable::destroy(); 158 161 159 162 //Collect scaling information. 160 defaultScale_ = this->pawn ->getScale3D();161 defaultMass_ = this->pawn ->getMass();163 defaultScale_ = this->pawn_->getScale3D(); 164 defaultMass_ = this->pawn_->getMass(); 162 165 163 166 smallScale_ = defaultScale_ / shrinkFactor_; … … 167 170 actualMass_ = defaultMass_; 168 171 169 cameraPositions_ = this->pawn ->getCameraPositions();172 cameraPositions_ = this->pawn_->getCameraPositions(); 170 173 size_ = cameraPositions_.size(); 171 174 isActive_ = true; //start shrinking now. 172 durationTimer .setTimer(duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this))); //Set timer for termination.175 durationTimer_.setTimer(duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this))); //Set timer for termination. 173 176 } 174 177 } 175 178 176 179 /** 177 180 @brief 178 181 Updates the scales of the ship. … … 189 192 actualMass_ /= factor_; 190 193 191 this->pawn ->setScale3D(actualScale_);192 this->pawn ->setMass(actualMass_);194 this->pawn_->setScale3D(actualScale_); 195 this->pawn_->setMass(actualMass_); 193 196 194 197 for(int index = 0; index < size_; index++) 195 198 { 196 CameraPosition* cameraPos_ = this->pawn ->getCameraPosition(index);199 CameraPosition* cameraPos_ = this->pawn_->getCameraPosition(index); 197 200 if(cameraPos_ == NULL) 198 201 continue; … … 209 212 actualMass_ *= factor_; 210 213 211 this->pawn ->setScale3D(actualScale_);212 this->pawn ->setMass(actualMass_);214 this->pawn_->setScale3D(actualScale_); 215 this->pawn_->setMass(actualMass_); 213 216 214 217 for(int index = 0; index < size_; index++) 215 218 { 216 CameraPosition* cameraPos_ = this->pawn ->getCameraPosition(index);219 CameraPosition* cameraPos_ = this->pawn_->getCameraPosition(index); 217 220 if(cameraPos_ == NULL) 218 221 continue; … … 225 228 } 226 229 227 230 /** 228 231 @brief 229 232 Initializes the termination. … … 244 247 } 245 248 246 249 /** 247 250 @brief 248 251 Creates a duplicate of the input OrxonoxClass. -
code/branches/pickup/src/modules/pickup/items/ShrinkPickup.h
r8536 r8554 48 48 49 49 /** 50 50 @author 51 51 Sandro Sgier 52 52 … … 101 101 private: 102 102 void initialize(void); 103 float duration_; 103 float duration_; //!< determines how long the pickup will be active 104 104 float shrinkFactor_; //shrink factor of the space ship 105 105 float shrinkSpeed_; //speed of shrinking … … 114 114 float defaultMass_; 115 115 float actualMass_; 116 float smallMass_; 116 float smallMass_; 117 117 Pawn* carrierToPawnHelper(void); 118 Pawn* pawn ;119 Timer durationTimer ;118 Pawn* pawn_; 119 Timer durationTimer_; 120 120 void terminate(void); 121 121 }; -
code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r8422 r8554 261 261 CollisionShape::changedScale(); 262 262 263 // Iterate through all attached CollisionShapes. 263 std::vector<CollisionShape*> shapes; 264 // Iterate through all attached CollisionShapes and add them to the list of shapes. 265 for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++) 266 shapes.push_back(it->first); 267 268 // Delete the compound shape and create a new one. 269 delete this->compoundShape_; 270 this->compoundShape_ = new btCompoundShape(); 271 272 // Re-attach all CollisionShapes. 273 for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++) 274 { 275 CollisionShape* shape = *it; 276 shape->setScale3D(this->getScale3D()); 277 // Only actually attach if we didn't pick a CompoundCollisionShape with no content. 278 if (shape->getCollisionShape()) 279 { 280 btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition())); 281 // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape. 282 this->compoundShape_->addChildShape(transf, shape->getCollisionShape()); 283 } 284 } 285 286 this->updatePublicShape(); 287 288 /* 289 // Iterate through all attached CollisionShapes 264 290 for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++) 265 291 { … … 269 295 } 270 296 271 this->updatePublicShape(); 297 this->updatePublicShape();*/ 272 298 } 273 299 } -
code/branches/pickup/src/orxonox/collisionshapes/CompoundCollisionShape.h
r8422 r8554 52 52 Reto Grieder 53 53 54 @see btCompoundShape 54 55 @ingroup Collisionshapes 55 56 */ -
code/branches/pickup/src/orxonox/worldentities/WorldEntity.cc
r8422 r8554 643 643 { 644 644 // If physics is enabled scale the attached CollisionShape. 645 if (false &&this->hasPhysics() && this->collisionShape_ != NULL)645 /*if (this->hasPhysics() && this->collisionShape_ != NULL) 646 646 { 647 647 this->collisionShape_->setScale3D(scale); 648 } 648 }*/ 649 649 650 650 this->node_->setScale(scale);
Note: See TracChangeset
for help on using the changeset viewer.