Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1343 for code


Ignore:
Timestamp:
May 21, 2008, 4:41:13 PM (17 years ago)
Author:
FelixSchulthess
Message:

finally: the radar dots move continiously

Location:
code/branches/hud3/src/orxonox/hud
Files:
2 edited

Legend:

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

    r1342 r1343  
    6969        initialOrth_ = Vector3(0.0, 0.0, 1.0);
    7070        currentOrth_ = initialOrth_;
     71        plane = Plane(currentDir_, shipPos_);
    7172
    7273        setMetricsMode(Ogre::GMM_PIXELS);
     
    9293        currentDir_ = SpaceShip::instance_s->getOrientation()*initialDir_;              // according to beni....
    9394                currentOrth_ = SpaceShip::instance_s->getOrientation()*initialOrth_;
     95        plane = Plane(currentDir_, shipPos_);
    9496
    9597        RadarObject* ro = firstRadarObject_;
     
    141143
    142144        float RadarOverlayElement::calcPhi(RadarObject* obj){
    143             return(acos((currentOrth_.dotProduct(firstRadarObject_->pos_ - shipPos_))/
    144                 ((firstRadarObject_->pos_ - shipPos_).length()*currentOrth_.length())));
     145            // project difference vector on our plane...
     146            Ogre::Vector3 proj = plane.projectVector(obj->pos_ - shipPos_);
     147            // ...and find out the angle
     148            return(acos((currentOrth_.dotProduct(proj))/
     149            (currentOrth_.length()*proj.length())));
    145150        }
    146151
  • code/branches/hud3/src/orxonox/hud/RadarOverlayElement.h

    r1339 r1343  
    7272            Vector3 currentOrth_;
    7373            Vector3 shipPos_;                       // position of ship
     74            Ogre::Plane plane;                      // plane perpendicular to dir
    7475
    7576                        RadarObject* firstRadarObject_;         // start of linked list
Note: See TracChangeset for help on using the changeset viewer.