Changeset 9719
- Timestamp:
- Oct 28, 2013, 3:58:20 PM (11 years ago)
- Location:
- code/branches/radarDreiD
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/radarDreiD/data/overlays/HUD.oxo
r9526 r9719 68 68 <HUDRadar 69 69 name = "Radar" 70 background = "Orxonox/ Radar"70 background = "Orxonox/radar" 71 71 correctAspect = true 72 72 size = "0.17, 0.17" -
code/branches/radarDreiD/data/overlays/HUDTemplates3.oxo
r9526 r9719 108 108 /> 109 109 110 <!-- 110 111 <HUDRadar 111 112 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" 113 128 correctaspect = true 114 129 size = "0.17, 0.17" -
code/branches/radarDreiD/src/libraries/util/Math.cc
r8400 r9719 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Wolfgang Roenninger 26 26 * 27 27 */ … … 147 147 148 148 /** 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). 150 150 @param myposition My position 151 151 @param mydirection My viewing direction … … 190 190 return orxonox::Vector2( -sin_value * radius, cos_value * radius); 191 191 } 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 192 222 193 223 /** -
code/branches/radarDreiD/src/libraries/util/Math.h
r9550 r9719 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Wolfgang Roenninger 26 26 * 27 27 */ … … 92 92 _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition); 93 93 _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); 94 95 _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity); 95 96 -
code/branches/radarDreiD/src/modules/overlays/hud/HUDRadar.cc
r9667 r9719 64 64 this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png"; 65 65 this->shapeMaterials_[RadarViewable::Square] = "RadarSquare.png"; 66 this->setDetectionLimit( 1000 0.0f );66 this->setDetectionLimit( 1000.0f ); 67 67 this->owner_ = 0; 68 68 } … … 169 169 170 170 // 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_); 172 173 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 173 174 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.