Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 23, 2012, 5:56:57 PM (12 years ago)
Author:
decapitb
Message:

safety checkin

Location:
code/branches/captureTheFlag
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/captureTheFlag

  • code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc

    r9016 r9232  
    3636#include <OgreTextAreaOverlayElement.h>
    3737#include <OgrePanelOverlayElement.h>
     38#include <OgreEntity.h>
    3839
    3940#include "util/Math.h"
     
    4546#include "Radar.h"
    4647#include "graphics/Camera.h"
     48#include "graphics/Model.h"
     49#include "worldentities/MovableEntity.h"
    4750#include "controllers/HumanController.h"
    4851#include "worldentities/pawns/Pawn.h"
     
    8083    this->setNavMarkerSize ( 0.05f );
    8184    this->setDetectionLimit( 10000.0f );
     85
     86    //Ogre::Entity* ent = this->getScene()->getSceneManager()->createEntity("Arrow3D", "Arrow3D.mesh");
     87
     88    Model* arrow = new Model(this);
     89    this->arrowEntity = new MovableEntity(this);
     90    arrow->setMeshSource("Arrow3D.mesh");
     91    arrow->setSyncMode(0);
     92    this->arrowEntity->attach(arrow);
     93    this->arrowEntity->scale(1);
     94    this->arrowEntity->setVisible(true);
     95    this->arrowEntity->setPosition(0, +30, -100);
     96    this->arrowEntity->setSyncMode(0);
     97    this->arrowEntity->attachToNode(this->overlay3d_);
     98    //this->add3DMesh(arrowEntity);
     99
     100    //this->overlay3d_->setPosition(0, 0, 0);
     101    //this->overlay3d_->setVisible(false, true);
     102    this->overlay_->setZOrder(0);
     103    this->overlay_->show();
     104    hideArrow3D();
    82105}
    83106
     
    178201    unsigned int markerCount_ = 0;
    179202    bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player
     203
     204    //for the first element of sortedObjectList_ / the closest waypoint show the Arrow3D
     205    //set the direction of the arrow to the closest waypoint
     206    if(!sortedObjectList_.empty())
     207    {
     208        showArrow3D();
     209                sortedList::iterator firstIt = sortedObjectList_.begin();
     210
     211                Ogre::Vector3 pos1 = camTransform * firstIt->first->getRVWorldPosition();
     212                orxout(user_info, context::events()) << pos1 << endl;
     213                this->arrowEntity->setDirection(1-pos1.x, 1 - pos1.y, 1 - pos1.z);
     214
     215                //this->arrowEntity->rotate(quat);
     216                //this->overlay3d_->setDirection(pos1);
     217    }
     218    else{hideArrow3D();}
     219
    180220
    181221//         for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it)
     
    382422    this->background_->addChild ( text );
    383423
    384     sortedObjectList_.push_front ( std::make_pair ( object, ( unsigned int ) 0 ) );
     424    Ogre::Vector3 temp = object->getWorldEntity()->getPosition();
     425    unsigned int distance = sqrt(temp.x*temp.x+temp.y*temp.y+temp.z*temp.z);
     426
     427
     428
     429    sortedObjectList_.push_front ( std::make_pair ( object, distance ) );
    385430
    386431
     
    445490    }
    446491}
    447 
    448 }
     492void HUDNavigation::showArrow3D()
     493                { this->overlay3d_->setVisible(true, true);}
     494void HUDNavigation::hideArrow3D()
     495                { this->overlay3d_->setVisible(false, true);}
     496
     497
     498}
Note: See TracChangeset for help on using the changeset viewer.