Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9719


Ignore:
Timestamp:
Oct 28, 2013, 3:58:20 PM (11 years ago)
Author:
wroennin
Message:

Radar.cc: new function call, detectionlimit 10000→1000 ; Math.cc: new function get3DProjection; HUDTemplates.oxo: new HUDRadar

Location:
code/branches/radarDreiD
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/radarDreiD/data/overlays/HUD.oxo

    r9526 r9719  
    6868  <HUDRadar
    6969   name          = "Radar"
    70    background    = "Orxonox/Radar"
     70   background    = "Orxonox/radar"
    7171   correctAspect = true
    7272   size          = "0.17, 0.17"
  • code/branches/radarDreiD/data/overlays/HUDTemplates3.oxo

    r9526 r9719  
    108108    />
    109109
     110<!--
    110111    <HUDRadar
    111112     name          = "Radar"
    112      background    = "Orxonox/Radar"
     113     backgroundtex = "radar.png"
     114     correctaspect = true
     115     size          = "0.17, 0.17"
     116     position      = "1.0, 1.0"
     117     pickpoint     = "1.0, 1.0"
     118     rotation      = 0
     119     sensitivity   = 1.0
     120     halfDotSizeDistance = 3000
     121     maximumDotSize      = 0.1
     122    />
     123    -->
     124   
     125    <HUDRadar
     126     name          = "Radar"
     127     backgroundtex = "radar3D_test.png"
    113128     correctaspect = true
    114129     size          = "0.17, 0.17"
  • code/branches/radarDreiD/src/libraries/util/Math.cc

    r8400 r9719  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Wolfgang Roenninger
    2626 *
    2727 */
     
    147147
    148148    /**
    149         @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0° = 0, 180° = 1).
     149        @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0� = 0, 180� = 1).
    150150        @param myposition My position
    151151        @param mydirection My viewing direction
     
    190190            return orxonox::Vector2( -sin_value * radius, cos_value * radius);
    191191    }
     192
     193
     194    /**
     195            @brief Gets the 2D project vector for the 3D Radar .
     196            @param myposition My position
     197            @param mydirection My viewing direction
     198            @param otherposition The position of the other object
     199            @param mapangle The angle you look on the 3Dmap
     200            @param detectionlimit The limit in which objects are shown on the map
     201            @return The viewing direction
     202
     203            Examples:
     204             -
     205        */
     206    orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit)
     207    {
     208        //
     209        orxonox::Vector3 distance = otherposition - myposition;
     210
     211        // project difference vector on our plane
     212        orxonox::Vector3 projection = Ogre::Plane(mydirection, myposition).projectVector(distance);
     213
     214        //float projectionlength = projection.length();
     215
     216        // project vector for the rotated 3DMap
     217        float xcoordinate = projection.y/(2*detectionlimit);
     218        float ycoordinate = (projection.x*sin(mapangle)+projection.z*cos(mapangle))/(2*detectionlimit);
     219        return orxonox::Vector2(xcoordinate , ycoordinate);
     220    }
     221
    192222
    193223    /**
  • code/branches/radarDreiD/src/libraries/util/Math.h

    r9550 r9719  
    2323 *      Fabian 'x3n' Landau
    2424 *   Co-authors:
    25  *      ...
     25 *      Wolfgang Roenninger
    2626 *
    2727 */
     
    9292    _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
    9393    _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition);
     94    _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit);
    9495    _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity);
    9596
  • code/branches/radarDreiD/src/modules/overlays/hud/HUDRadar.cc

    r9667 r9719  
    6464        this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png";
    6565        this->shapeMaterials_[RadarViewable::Square]   = "RadarSquare.png";
    66         this->setDetectionLimit( 10000.0f );
     66        this->setDetectionLimit( 1000.0f );
    6767        this->owner_ = 0;
    6868    }
     
    169169
    170170            // calc position on radar...
    171             Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
     171            //Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition());
     172            Vector2 coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, wePointer->getWorldPosition(), 0.6435011, detectionLimit_);
    172173            coord *= math::pi / 3.5f; // small adjustment to make it fit the texture
    173174            it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);
Note: See TracChangeset for help on using the changeset viewer.