Changeset 8613 for code/branches/spaceboundaries2/src
- Timestamp:
- May 26, 2011, 5:23:31 PM (14 years ago)
- Location:
- code/branches/spaceboundaries2/src/orxonox/worldentities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
r8609 r8613 211 211 this->checkWhoIsIn(); 212 212 this->removeAllBillboards(); 213 COUT(4) << "Groesse der Pawn-Liste 'SpaceBoundaries::pawnsIn_': " << (int) pawnsIn_.size() << std::endl;214 213 215 214 float distance; … … 222 221 distance = this->computeDistance(currentPawn); 223 222 humanItem = this->isHumanPlayer(currentPawn); 224 COUT(5) << "Distan z:" << distance << std::endl; // message for debugging225 if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an!223 COUT(5) << "Distance:" << distance << std::endl; // message for debugging 224 if(distance > this->warnDistance_ && distance < this->maxDistance_) // Display warning 226 225 { 227 226 if(humanItem) 228 227 { 229 COUT(5) << "humanItem ist true" << std::endl;230 228 this->displayWarning("Attention! You are close to the boundary!"); 231 229 } … … 233 231 if(/* humanItem &&*/ abs(this->maxDistance_ - distance) < this->showDistance_ ) 234 232 { 235 this->displayBoundaries(currentPawn); // Zeige Grenze an!233 this->displayBoundaries(currentPawn); // Show the boundary 236 234 } 237 235 if(distance > this->maxDistance_ && (this->reaction_ == 1) ) … … 244 242 currentPawn->removeHealth( (distance - this->maxDistance_) * this->healthDecrease_); 245 243 } 246 if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Annahme: Ein Pawn kann von einem Tick bis zum nächsten nicht mehr als 100 Distanzeinheiten zurücklegen.244 if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Exception: A Pawn can't move more than 100 units per tick. 247 245 { 248 246 this->conditionalBounceBack(currentPawn, distance, dt); … … 290 288 float normalSpeed = item->getVelocity().dotProduct(normal); 291 289 292 /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde. 293 Falls ja: Spicke es zurück. */ 290 /* Check, whether the Pawn would leave the boundary in the next tick, if so send it back. */ 294 291 if( this->reaction_ == 0 && currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure" 295 292 { … … 314 311 item->setVelocity(*velocity * dampingFactor); 315 312 316 item->setPosition( item->getPosition() - *normal * 10 ); // Set ze das SpaceShip noch etwas von der Grenze weg.313 item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary. 317 314 } 318 315 -
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h
r8609 r8613 107 107 std::vector<billboardAdministration> billboards_; 108 108 109 int reaction_; //!< Werte: 0, 1, 2.110 //!< 0: Refle ktion an Boundaries(Standard).111 //!< 1: Health-Abzug-Modus.112 //!< 2: Invert ierte Version von 0. Verbiete es, in ein Gebiet hinein zu fliegen.113 float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.114 float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.115 float showDistance_; //!< D efiniert, wann die Grenzen visualisiert werden sollen. ("Entfernung von 'this->maxDistance_'")109 int reaction_; //!< Values: 0, 1, 2. 110 //!< 0: Reflection on boundary (Standard). 111 //!< 1: Decrease-Health-Mode. 112 //!< 2: Inverted Version of 0. Prohibit to fly INTO a defined area. 113 float maxDistance_; //!< Maximum allowed distance. 114 float warnDistance_; //!< Distance in which a warning is displayed. 115 float showDistance_; //!< Distance at which the boundaries are displayed. 116 116 117 float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden. 118 //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung). 119 //!< Hat nur eine Bedeutung, falls 'this->reaction_' 1 (eins) ist. 117 float healthDecrease_; //!< Rate of health loss. 120 118 121 122 RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar. 123 119 //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar. 124 120 125 121 // Funktionen:: 126 float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.127 void displayWarning(const std::string warnText); //!< Einen Warntext auf dem Bildschirm ausgeben. (noch nicht implementiert, TODO)122 float computeDistance(WorldEntity *item); //!< Compute distance to center point. 123 void displayWarning(const std::string warnText); //!< TODO: Implement. 128 124 void displayBoundaries(Pawn *item); 129 125 void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
Note: See TracChangeset
for help on using the changeset viewer.