Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 20, 2008, 12:05:12 AM (16 years ago)
Author:
rgrieder
Message:
  • Radar now working like before
  • but more of a svn save..

There is class called Radar which takes care of the focus and all objects that can be displayed on a Radar.
The actual visual implementation is in HUDRadar.
To make a object radar viewable, simply implement RadarViewable and set the WorldEntitiy pointer in the constructor (assertation will fail otherwise!).
You can also set a camouflage value between 0 and 1 that tells how good a radar can see an object.
The HUDRadar (or another one) on the other side has a sensitivity between 0 and 1. So only if the sensitivity is higher than the camouflage value, the object gets displayed.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/RadarViewable.cc

    r1609 r1613  
    3838    */
    3939    RadarViewable::RadarViewable()
    40         : radarObjectVisibility_(1.0f)
     40        : radarObjectCamouflage_(0.0f)
     41        , radarObjectType_(Dot)
    4142        , radarObject_(0)
     43        , radarObjectDescription_("staticObject")
    4244    {
    4345        RegisterRootObject(RadarViewable);
    4446    }
    4547
    46     void RadarViewable::unregisterFromRadar()
     48    void RadarViewable::setRadarObjectDescription(const std::string& str)
     49    {
     50        Radar* radar = Radar::getInstancePtr();
     51        if (radar)
     52            this->radarObjectType_ = radar->addObjectDescription(str);
     53        else
     54        {
     55            CCOUT(2) << "Attempting to access the radar, but the radar is non existent." << std::endl;
     56        }
     57        this->radarObjectDescription_ = str;
     58    }
     59
     60    /*void RadarViewable::unregisterFromRadar()
    4761    {
    4862        Radar* radar = Radar::getInstancePtr();
     
    5367            CCOUT(2) << "Attempting to unregister an object to the radar, but the radar is non existent." << std::endl;
    5468        }
    55     }
     69    }*/
    5670}
Note: See TracChangeset for help on using the changeset viewer.