[Orxonox-commit 3939] r8613 - code/branches/spaceboundaries2/src/orxonox/worldentities
dafrick at orxonox.net
dafrick at orxonox.net
Thu May 26 17:23:32 CEST 2011
Author: dafrick
Date: 2011-05-26 17:23:31 +0200 (Thu, 26 May 2011)
New Revision: 8613
Modified:
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h
Log:
Cleanup.
Modified: code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc
===================================================================
--- code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc 2011-05-26 15:16:39 UTC (rev 8612)
+++ code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc 2011-05-26 15:23:31 UTC (rev 8613)
@@ -210,7 +210,6 @@
{
this->checkWhoIsIn();
this->removeAllBillboards();
- COUT(4) << "Groesse der Pawn-Liste 'SpaceBoundaries::pawnsIn_': " << (int) pawnsIn_.size() << std::endl;
float distance;
bool humanItem;
@@ -221,18 +220,17 @@
{
distance = this->computeDistance(currentPawn);
humanItem = this->isHumanPlayer(currentPawn);
- COUT(5) << "Distanz:" << distance << std::endl; // message for debugging
- if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an!
+ COUT(5) << "Distance:" << distance << std::endl; // message for debugging
+ if(distance > this->warnDistance_ && distance < this->maxDistance_) // Display warning
{
if(humanItem)
{
- COUT(5) << "humanItem ist true" << std::endl;
this->displayWarning("Attention! You are close to the boundary!");
}
}
if(/* humanItem &&*/ abs(this->maxDistance_ - distance) < this->showDistance_ )
{
- this->displayBoundaries(currentPawn); // Zeige Grenze an!
+ this->displayBoundaries(currentPawn); // Show the boundary
}
if(distance > this->maxDistance_ && (this->reaction_ == 1) )
{
@@ -243,7 +241,7 @@
}
currentPawn->removeHealth( (distance - this->maxDistance_) * this->healthDecrease_);
}
- 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.
+ if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Exception: A Pawn can't move more than 100 units per tick.
{
this->conditionalBounceBack(currentPawn, distance, dt);
}
@@ -289,8 +287,7 @@
Vector3 velocity = item->getVelocity();
float normalSpeed = item->getVelocity().dotProduct(normal);
- /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde.
- Falls ja: Spicke es zurück. */
+ /* Check, whether the Pawn would leave the boundary in the next tick, if so send it back. */
if( this->reaction_ == 0 && currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
{
bounceBack(item, &normal, &velocity);
@@ -313,7 +310,7 @@
item->setAcceleration(acceleration * dampingFactor);
item->setVelocity(*velocity * dampingFactor);
- item->setPosition( item->getPosition() - *normal * 10 ); // Setze das SpaceShip noch etwas von der Grenze weg.
+ item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
}
bool SpaceBoundaries::isHumanPlayer(Pawn *item)
Modified: code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h
===================================================================
--- code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h 2011-05-26 15:16:39 UTC (rev 8612)
+++ code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h 2011-05-26 15:23:31 UTC (rev 8613)
@@ -106,25 +106,21 @@
std::vector<billboardAdministration> billboards_;
- int reaction_; //!< Werte: 0, 1, 2.
- //!< 0: Reflektion an Boundaries (Standard).
- //!< 1: Health-Abzug-Modus.
- //!< 2: Invertierte Version von 0. Verbiete es, in ein Gebiet hinein zu fliegen.
- float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
- float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.
- float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen. ("Entfernung von 'this->maxDistance_'")
+ int reaction_; //!< Values: 0, 1, 2.
+ //!< 0: Reflection on boundary (Standard).
+ //!< 1: Decrease-Health-Mode.
+ //!< 2: Inverted Version of 0. Prohibit to fly INTO a defined area.
+ float maxDistance_; //!< Maximum allowed distance.
+ float warnDistance_; //!< Distance in which a warning is displayed.
+ float showDistance_; //!< Distance at which the boundaries are displayed.
- float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden.
- //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung).
- //!< Hat nur eine Bedeutung, falls 'this->reaction_' 1 (eins) ist.
+ float healthDecrease_; //!< Rate of health loss.
-
- RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar.
+ //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
-
// Funktionen::
- float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.
- void displayWarning(const std::string warnText); //!< Einen Warntext auf dem Bildschirm ausgeben. (noch nicht implementiert, TODO)
+ float computeDistance(WorldEntity *item); //!< Compute distance to center point.
+ void displayWarning(const std::string warnText); //!< TODO: Implement.
void displayBoundaries(Pawn *item);
void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
More information about the Orxonox-commit
mailing list