Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

finally: the radar dots move continiously

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.