Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 11, 2012, 4:20:50 PM (13 years ago)
Author:
scmoritz
Message:

3D arrow trial

Location:
code/branches/waypoints/src/modules/overlays/hud
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.cc

    r9159 r9177  
    4646#include "Radar.h"
    4747#include "graphics/Camera.h"
     48#include "graphics/Model.h"
     49#include "worldentities/MovableEntity.h"
    4850#include "controllers/HumanController.h"
    4951#include "worldentities/pawns/Pawn.h"
     
    8284    this->setDetectionLimit( 10000.0f );
    8385
    84     Ogre::Entity* ent = this->getScene()->getSceneManager()->createEntity("Arrow3D", "Arrow3D.mesh");
    85     this->add3DMesh(ent);
    86     this->overlay3d_->setPosition(0, 0, -10);
     86    //Ogre::Entity* ent = this->getScene()->getSceneManager()->createEntity("Arrow3D", "Arrow3D.mesh");
     87
     88    Model* arrow = new Model(this);
     89    MovableEntity* arrowEntity = new MovableEntity(this);
     90    arrow->setMeshSource("Arrow3D.mesh");
     91    arrowEntity->attach(arrow);
     92    arrowEntity->setVisible(true);
     93    arrowEntity->scale(1);
     94    arrowEntity->setPosition(0, 0, -200);
     95    arrowEntity->attachToNode(this->overlay3d_);
     96    //this->add3DMesh(arrowEntity);
     97
     98    this->overlay3d_->setPosition(0, 0, -200);
     99    this->overlay3d_->setVisible(false, true);
    87100}
    88101
     
    183196    unsigned int markerCount_ = 0;
    184197    bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
     198
     199    //for the first element of sortedObjectList_ / the closest waypoint show the Arrow3D
     200    if(!sortedObjectList_.empty())
     201    {
     202        showArrow3D();
     203                sortedList::iterator firstIt = sortedObjectList_.begin();
     204                Ogre::Vector3 pos1 = firstIt->first->getRVWorldPosition();
     205                Ogre::Vector3 pos2 = cam->getPosition();
     206                Ogre::Quaternion quat = pos2.getRotationTo(pos1);
     207                this->overlay3d_->rotate(quat);
     208                //this->overlay3d_->setDirection(pos1-pos2);
     209    }
     210
    185211
    186212//         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
     
    450476    }
    451477}
    452 
    453 }
     478void HUDNavigation::showArrow3D()
     479                { this->overlay3d_->setVisible(true, true);}
     480void HUDNavigation::hideArrow3D()
     481                { this->overlay3d_->setVisible(false, true);}
     482
     483
     484}
  • code/branches/waypoints/src/modules/overlays/hud/HUDNavigation.h

    r9016 r9177  
    4242#include "overlays/OrxonoxOverlay.h"
    4343
     44
    4445namespace orxonox
    4546{
     
    5152
    5253    void setConfigValues();
     54
     55
    5356
    5457    virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode );
     
    8083
    8184    };
     85
     86    void showArrow3D();
     87    void hideArrow3D();
    8288
    8389    bool showObject( RadarViewable* rv );
Note: See TracChangeset for help on using the changeset viewer.