Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8468


Ignore:
Timestamp:
May 12, 2011, 4:36:30 PM (13 years ago)
Author:
kmaurus
Message:

several small improvements

Location:
code/branches/spaceboundaries2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceboundaries2/data/levels/myTestLevel.oxw

    r8458 r8468  
    3232    <SpawnPoint team=0 position="0,0,0" lookat="2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    3333   
    34     <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" healthDecrease="0.1" position="0,0,0"/>
     34    <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" reactionMode="0" healthDecrease="0.9" position="0,0,0"/>
    3535   
    3636  </Scene>
  • code/branches/spaceboundaries2/doc/api/Groups.dox

    r8108 r8468  
    161161    @ingroup Modules
    162162*/
     163
     164/**
     165    @defgroup SpaceBoundaries Space Boundaries
     166    @ingroup Modules
     167*/
  • code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.cc

    r8458 r8468  
    4747         * falls im XML-File keine Werte spezifiziert wurden. */
    4848        this->setMaxDistance(3000);
    49         this->setWarnDistance(2000);
    50         this->setShowDistance(2500);
    51         this->setHealthDecrease(1);
     49        this->setWarnDistance(this->getMaxDistance());
     50        this->setShowDistance(this->getMaxDistance());
    5251        this->setReaction(0);
    5352       
     
    8180        {
    8281            Pawn* currentPawn = *current;
    83             float distance = this->computeDistance(currentPawn);
    84             if(distance <= this->maxDistance_)
    85             {
     82            if( this->reaction_ == 0 )
     83            {
     84                float distance = this->computeDistance(currentPawn);
     85                if(distance <= this->maxDistance_)
     86                {
     87                    pawnsIn_.push_back(currentPawn);
     88                }
     89            } else {
    8690                pawnsIn_.push_back(currentPawn);
    8791            }
     
    183187        XMLPortParam(SpaceBoundaries, "maxDistance", setMaxDistance, getMaxDistance, xmlelement, mode);
    184188        XMLPortParam(SpaceBoundaries, "warnDistance", setWarnDistance, getWarnDistance, xmlelement, mode);
     189        XMLPortParam(SpaceBoundaries, "showDistance", setShowDistance, getShowDistance, xmlelement, mode);
    185190        XMLPortParam(SpaceBoundaries, "healthDecrease", setHealthDecrease, getHealthDecrease, xmlelement, mode);
    186191        XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
     
    191196        this->checkWhoIsIn();
    192197        this->removeAllBillboards();
    193         COUT(0) << "Groesse der Liste: " << (int) pawnsIn_.size() << std::endl;
     198        COUT(4) << "Groesse der Pawn-Liste 'SpaceBoundaries::pawnsIn_': " << (int) pawnsIn_.size() << std::endl;
    194199       
    195200        float distance;
     
    202207                distance = this->computeDistance(currentPawn);
    203208                humanItem = this->isHumanPlayer(currentPawn);
    204                 COUT(0) << "Distanz:" << distance << std::endl; // message for debugging
     209                COUT(5) << "Distanz:" << distance << std::endl; // message for debugging
    205210                if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an!
    206211                {
    207                     COUT(0) << "You are near by the boundaries!" << std::endl; // message for debugging
    208212                    if(humanItem)
    209213                    {
    210                         COUT(0) << "humanItem ist true" << std::endl;
    211                         this->displayWarning("Attention! You are near by the boundaries!");
     214                        COUT(5) << "humanItem ist true" << std::endl;
     215                        this->displayWarning("Attention! You are close to the boundary!");
    212216                    }
    213217                }
    214                 if( (this->maxDistance_ - distance) < this->showDistance_ )
     218                if( humanItem && (this->maxDistance_ - distance) < this->showDistance_ )
    215219                {
    216220                    this->displayBoundaries(currentPawn); // Zeige Grenze an!
     
    220224                    if( humanItem )
    221225                    {
    222                         COUT(0) << "Health should be decreasing!" << std::endl;
     226                        COUT(5) << "Health should be decreasing!" << std::endl;
    223227                        this->displayWarning("You are out of the area now!");
    224228                    }
     
    269273        /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde.
    270274           Falls ja: Spicke es zurück. */
    271         if( currentDistance + normalSpeed * dt > this->maxDistance_ )
     275        if( currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
    272276        {
    273277            float dampingFactor = 0.5;
  • code/branches/spaceboundaries2/src/orxonox/worldentities/SpaceBoundaries.h

    r8458 r8468  
    3131                (file:///home/kmaurus/orxonox/spaceBoundaries/build/doc/api/html/classorxonox_1_1_host.html#9c1e3b39e3b42e467dfbf42902911ce2)
    3232               
    33             - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h')
    34            
    35             - Wiki-SpaceBoundaries-Eintrag aktualisieren
     33                Mich finde ich unter humanPlayer ...
     34               
     35            - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h')
     36                oder brauche groups-file.
    3637 */
    3738
     
    5859@brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
    5960
    60        Five attributes can/should be defined in the XML-File:
     61       Some attributes can/should be defined in the XML-File:
     62       - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0)
     63       - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
    6164       - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
    6265                          inform the player that he'll soon be leaving the allowed area.
    63        - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
    6466       - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
    65        - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
    66                             Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
    6767       - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
    6868                            0: Reflect the space ship (default).
    6969                            1: Decrease Health of the space ship after having left the allowed area.
     70       - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
     71                            Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
     72
     73Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
     74
     75Examples:
     76Two examples how one could include SpaceBoundaries in the XML-File. The first one uses reflection, the second one health decrease.
     77@code
     78<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />
     79@endcode
     80
     81@code
     82<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
     83@endcode
    7084*/
    7185
Note: See TracChangeset for help on using the changeset viewer.