Changeset 1566 for code/trunk/src/orxonox/hud
- Timestamp:
- Jun 8, 2008, 5:04:18 PM (16 years ago)
- Location:
- code/trunk/src/orxonox/hud
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/hud/Navigation.cc
r1564 r1566 36 36 // TODO: remove the SpaceShip and CameraHandler dependencies 37 37 #include "objects/SpaceShip.h" 38 #include "objects/Projectile.h" 38 39 #include "objects/CameraHandler.h" 39 40 #include "RadarObject.h" … … 87 88 navMarker_->hide(); 88 89 aimMarker_->hide(); 90 aimMarker_->setMaterialName("Orxonox/NavCrosshair"); 91 aimMarker_->setDimensions(20, 20); 92 aimMarker_->setUV(0.0, 0.0, 1.0, 1.0); 89 93 container_->addChild(navMarker_); 90 94 container_->addChild(aimMarker_); … … 106 110 navText_->setCaption(Ogre::StringConverter::toString(dist)); 107 111 108 Vector3 pos = focus_->getPosition();109 112 Ogre::Camera* navCam = SpaceShip::getLocalShip()->getCamera()->cam_; 110 113 // transform to screen coordinates 111 pos = navCam->getProjectionMatrix() * navCam->getViewMatrix() * pos; 114 Vector3 pos = navCam->getProjectionMatrix() * navCam->getViewMatrix() * focus_->getPosition(); 115 Vector3 aimpos = navCam->getProjectionMatrix() * navCam->getViewMatrix() * getPredictedPosition(SpaceShip::getLocalShip()->getPosition(), Projectile::getSpeed(), focus_->getPosition(), focus_->getOrientedVelocity()); 112 116 113 117 float xPosRel = 0.5*pos.x+0.5; 114 118 float yPosRel = 1-(0.5*pos.y+0.5); 119 float xAimPosRel = 0.5*aimpos.x+0.5; 120 float yAimPosRel = 1-(0.5*aimpos.y+0.5); 115 121 int xPos = (int) (xPosRel*windowW); 116 122 int yPos = (int) (yPosRel*windowH); 123 int xAimPos = (int) (xAimPosRel*windowW); 124 int yAimPos = (int) (yAimPosRel*windowH); 117 125 int xFromCenter = xPos-windowW/2; 118 126 int yFromCenter = yPos-windowH/2; … … 133 141 navMarker_->setMaterialName("Orxonox/NavArrows"); 134 142 navMarker_->setDimensions(16,16); 143 aimMarker_->hide(); 135 144 float phiUpperCorner = atan((float)(windowW)/(float)(windowH)); 136 145 // from the angle we find out on which edge to draw the marker … … 210 219 // object is in view 211 220 navMarker_->setMaterialName("Orxonox/NavTDC"); 212 navMarker_->setDimensions( 24,24);221 navMarker_->setDimensions(35, 35); 213 222 navMarker_->setUV(0.0, 0.0, 1.0, 1.0); 214 223 navMarker_->setPosition(xPos-navMarker_->getWidth()/2, yPos-navMarker_->getHeight()/2); 224 225 aimMarker_->show(); 226 aimMarker_->setPosition(xAimPos-aimMarker_->getWidth()/2, yAimPos-aimMarker_->getHeight()/2); 227 215 228 navText_->setPosition(xPos+navMarker_->getWidth()/2, yPos+navMarker_->getHeight()/2); 216 229 } … … 259 272 if(focus_ == NULL){ 260 273 navMarker_->hide(); 274 aimMarker_->hide(); 261 275 navText_->hide(); 262 276 } -
code/trunk/src/orxonox/hud/RadarObject.cc
r1564 r1566 120 120 } 121 121 122 const Vector3& RadarObject::getVelocity() const122 Vector3 RadarObject::getOrientedVelocity() const 123 123 { 124 return this->object_->get Velocity();124 return this->object_->getOrientation() * this->object_->getVelocity(); 125 125 } 126 126 } -
code/trunk/src/orxonox/hud/RadarObject.h
r1564 r1566 54 54 55 55 const Vector3& getPosition() const; 56 const Vector3& getVelocity() const;56 Vector3 getOrientedVelocity() const; 57 57 58 58 inline WorldEntity* getObject() const
Note: See TracChangeset
for help on using the changeset viewer.