Changeset 10241 for code/branches/hudHS14
- Timestamp:
- Feb 1, 2015, 8:57:37 PM (10 years ago)
- Location:
- code/branches/hudHS14
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hudHS14/data/overlays/HUDTemplates3.oxo
r10149 r10241 36 36 size = "0.35, 0.0875" 37 37 position = "0.0 , 0.9 " 38 pickpoint = "0, 1" 38 pickpoint = "0, 1" 39 39 bartexture = "healthbar_bar.png" 40 40 textfont = "VeraMono" -
code/branches/hudHS14/src/modules/overlays/hud/HUDEnemyHealthBar.cc
r10143 r10241 31 31 #include "core/config/ConfigValueIncludes.h" 32 32 #include "worldentities/pawns/Pawn.h" 33 #include "graphics/Camera.h"34 33 35 34 namespace orxonox … … 58 57 this->updateTarget(); 59 58 60 61 62 /*63 //--------------------------------------------------------------------------64 //first try to place a healthbar under the enemy ship65 //getting all the parameters (direction, position, angle) to place the health bar on the screen66 67 Camera* camera = this->owner_->getCamera();68 69 //position and orientation relative to the root space70 Vector3 cameraPosition = camera->getWorldPosition();71 Quaternion cameraOrientation = camera->getWorldOrientation();72 73 Vector3 cameraDirection = camera->FRONT;74 Vector3 cameraOrthonormal = camera->UP;75 76 //get target77 //if there is one get it's position (relative to the root space(78 WorldEntity* target = this->owner_->getTarget();79 80 if(target != NULL){81 Vector3 targetPosition = target->getWorldPosition();82 83 84 //try 185 Vector2 screenCoordinates = get2DViewcoordinates(cameraPosition, cameraOrientation * WorldEntity::FRONT, cameraOrientation * WorldEntity::UP, targetPosition);86 87 orxout() << screenCoordinates.x << endl;88 89 //shift coordinates because the screen has it's root in the upper left corner (0,0) but get2Dviewcoordiantes return values between -0.5 and 0.590 screenCoordinates.x += 0.5;91 screenCoordinates.y += 0.5;92 orxout() << screenCoordinates.x << endl;93 94 this->setPosition(screenCoordinates);95 96 this->setTextOffset(screenCoordinates);97 }98 //--------------------------------------------------------------------------99 */100 101 102 103 59 SUPER(HUDEnemyHealthBar, tick, dt); 104 60 } … … 115 71 target = target->getParent(); 116 72 pawn = orxonox_cast<Pawn*>(target); 117 118 119 73 // Don't show the HealthBar if the pawn is invisible 120 74 if (pawn && !pawn->isVisible()) 121 75 pawn = NULL; 122 76 } 123 124 77 // Set the pawn as owner of the HealthBar 125 78 this->setHealthBarOwner(pawn); -
code/branches/hudHS14/src/modules/overlays/hud/HUDHealthBar.cc
r10110 r10241 83 83 SUPER(HUDHealthBar, tick, dt); 84 84 85 86 87 88 89 85 if (this->owner_) 90 86 {
Note: See TracChangeset
for help on using the changeset viewer.