Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 8, 2009, 11:48:52 AM (15 years ago)
Author:
scheusso
Message:

radar working again (also focus incl. cycleNavigationFocus)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation2/src/orxonox/Radar.cc

    r5929 r6273  
    4040#include "core/ObjectList.h"
    4141#include "interfaces/RadarListener.h"
     42#include "controllers/HumanController.h"
     43#include "worldentities/pawns/Pawn.h"
    4244
    4345namespace orxonox
     
    4648    Radar::Radar()
    4749        : focus_(0)
     50        , itFocus_(0)
    4851        , objectTypeCounter_(0)
    4952    {
     
    118121    void Radar::cycleFocus()
    119122    {
    120         if (ObjectList<RadarViewable>::begin() == 0)
     123        if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end())
    121124        {
    122125            // list is empty
     
    124127            this->focus_ = 0;
    125128        }
    126 /*
    127         else if (this->owner_)
     129
     130        else if (HumanController::getLocalControllerEntityAsPawn())
    128131        {
    129             Vector3 localPosition = this->owner_->getPosition();
     132            Vector3 localPosition = HumanController::getLocalControllerEntityAsPawn()->getWorldPosition();
    130133            Vector3 targetPosition = localPosition;
    131             if (*(this->itFocus_))
     134            if (this->itFocus_ && *(this->itFocus_))
    132135                targetPosition = this->itFocus_->getRVWorldPosition();
    133136
    134             // find the closed object further away than targetPosition
     137            // find the closest object further away than targetPosition
    135138            float currentDistance = localPosition.squaredDistance(targetPosition);
    136139            float nextDistance = FLT_MAX;
     
    140143            for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)
    141144            {
    142                 if (*it == static_cast<RadarViewable*>(this)->owner_)
     145                if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn()))
    143146                    continue;
    144147
     
    167170            }
    168171        }
    169 */
    170172    }
    171173
Note: See TracChangeset for help on using the changeset viewer.