Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 20, 2011, 11:27:45 PM (13 years ago)
Author:
dafrick
Message:

Some cleanup…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/objects/SpaceBoundaries.cc

    r8706 r8767  
    5858        {
    5959            this->pawnsIn_.clear();
    60        
     60
    6161            for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)
    6262            {
     
    6969        }
    7070    }
    71    
     71
    7272    void SpaceBoundaries::checkWhoIsIn()
    7373    {
     
    9494        }
    9595    }
    96    
     96
    9797    void SpaceBoundaries::positionBillboard(const Vector3& position, float alpha)
    9898    {
     
    124124        this->billboards_[current].billy->setCommonUpVector(upVector);
    125125    }
    126    
     126
    127127    void SpaceBoundaries::setBillboardOptions(Billboard *billy)
    128128    {
     
    135135        }
    136136    }
    137    
     137
    138138    void SpaceBoundaries::removeAllBillboards()
    139139    {
     
    144144        }
    145145    }
    146    
     146
    147147    void SpaceBoundaries::setMaxDistance(float r)
    148148    {
     
    153153        return this->maxDistance_;
    154154    }
    155    
     155
    156156    void SpaceBoundaries::setWarnDistance(float r)
    157157    {
     
    162162        return this->warnDistance_;
    163163    }
    164    
     164
    165165    void SpaceBoundaries::setShowDistance(float r)
    166166    {
     
    171171        return this->showDistance_;
    172172    }
    173    
     173
    174174    void SpaceBoundaries::setHealthDecrease(float amount)
    175175    {
     
    180180        return this->healthDecrease_;
    181181    }
    182    
     182
    183183    void SpaceBoundaries::setReaction(int mode)
    184184    {
     
    200200        XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
    201201    }
    202    
     202
    203203    void SpaceBoundaries::tick(float dt)
    204204    {
    205205        this->checkWhoIsIn();
    206206        this->removeAllBillboards();
    207        
     207
    208208        float distance;
    209209        bool humanItem;
     
    247247        }
    248248    }
    249    
     249
    250250    float SpaceBoundaries::computeDistance(WorldEntity *item)
    251251    {
     
    258258        }
    259259    }
    260    
     260
    261261    void SpaceBoundaries::displayWarning(const std::string warnText)
    262     {   
     262    {
    263263        // TODO
    264264    }
    265    
     265
    266266    void SpaceBoundaries::displayBoundaries(Pawn *item, float alpha)
    267267    {
    268        
     268
    269269        Vector3 direction = item->getPosition() - this->getPosition();
    270270        direction.normalise();
    271        
     271
    272272        Vector3 boundaryPosition = this->getPosition() + direction * this->maxDistance_;
    273        
     273
    274274        this->positionBillboard(boundaryPosition, alpha);
    275275    }
    276    
     276
    277277    void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt)
    278278    {
     
    281281        Vector3 velocity = item->getVelocity();
    282282        float normalSpeed = item->getVelocity().dotProduct(normal);
    283        
     283
    284284        /* Check, whether the Pawn would leave the boundary in the next tick, if so send it back. */
    285285        if( this->reaction_ == 0 && currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
     
    292292        }
    293293    }
    294    
     294
    295295    void SpaceBoundaries::bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity)
    296296    {
     
    299299        Vector3 acceleration = item->getAcceleration();
    300300        acceleration = acceleration.reflect(*normal);
    301        
     301
    302302        item->lookAt( *velocity + this->getPosition() );
    303        
     303
    304304        item->setAcceleration(acceleration * dampingFactor);
    305305        item->setVelocity(*velocity * dampingFactor);
    306        
     306
    307307        item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
    308308    }
    309    
     309
    310310    bool SpaceBoundaries::isHumanPlayer(Pawn *item)
    311311    {
     
    319319        return false;
    320320    }
    321    
     321
    322322}
Note: See TracChangeset for help on using the changeset viewer.