Changeset 9232 for code/branches/captureTheFlag/src/modules/overlays
- Timestamp:
- May 23, 2012, 5:56:57 PM (13 years ago)
- Location:
- code/branches/captureTheFlag
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/captureTheFlag
- Property svn:mergeinfo changed
/code/branches/waypoints (added) merged: 9032,9043,9054,9093,9105,9159,9177,9219
- Property svn:mergeinfo changed
-
code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.cc
r9016 r9232 36 36 #include <OgreTextAreaOverlayElement.h> 37 37 #include <OgrePanelOverlayElement.h> 38 #include <OgreEntity.h> 38 39 39 40 #include "util/Math.h" … … 45 46 #include "Radar.h" 46 47 #include "graphics/Camera.h" 48 #include "graphics/Model.h" 49 #include "worldentities/MovableEntity.h" 47 50 #include "controllers/HumanController.h" 48 51 #include "worldentities/pawns/Pawn.h" … … 80 83 this->setNavMarkerSize ( 0.05f ); 81 84 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(); 82 105 } 83 106 … … 178 201 unsigned int markerCount_ = 0; 179 202 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 180 220 181 221 // for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it) … … 382 422 this->background_->addChild ( text ); 383 423 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 ) ); 385 430 386 431 … … 445 490 } 446 491 } 447 448 } 492 void HUDNavigation::showArrow3D() 493 { this->overlay3d_->setVisible(true, true);} 494 void HUDNavigation::hideArrow3D() 495 { this->overlay3d_->setVisible(false, true);} 496 497 498 } -
code/branches/captureTheFlag/src/modules/overlays/hud/HUDNavigation.h
r9016 r9232 42 42 #include "overlays/OrxonoxOverlay.h" 43 43 44 44 45 namespace orxonox 45 46 { … … 51 52 52 53 void setConfigValues(); 54 55 53 56 54 57 virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode ); … … 80 83 81 84 }; 85 86 void showArrow3D(); 87 void hideArrow3D(); 88 89 orxonox::MovableEntity* arrowEntity; 82 90 83 91 bool showObject( RadarViewable* rv );
Note: See TracChangeset
for help on using the changeset viewer.