- Timestamp:
- Dec 11, 2014, 1:01:28 PM (10 years ago)
- Location:
- code/branches/presentationHS14
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentationHS14
- Property svn:mergeinfo changed
/code/branches/hudHS14 (added) merged: 10083,10110,10122,10143,10149,10163
- Property svn:mergeinfo changed
-
code/branches/presentationHS14/src/modules/overlays/hud/HUDEnemyHealthBar.cc
r9667 r10171 31 31 #include "core/config/ConfigValueIncludes.h" 32 32 #include "worldentities/pawns/Pawn.h" 33 #include "graphics/Camera.h" 33 34 34 35 namespace orxonox … … 57 58 this->updateTarget(); 58 59 60 61 62 /* 63 //-------------------------------------------------------------------------- 64 //first try to place a healthbar under the enemy ship 65 //getting all the parameters (direction, position, angle) to place the health bar on the screen 66 67 Camera* camera = this->owner_->getCamera(); 68 69 //position and orientation relative to the root space 70 Vector3 cameraPosition = camera->getWorldPosition(); 71 Quaternion cameraOrientation = camera->getWorldOrientation(); 72 73 Vector3 cameraDirection = camera->FRONT; 74 Vector3 cameraOrthonormal = camera->UP; 75 76 //get target 77 //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 1 85 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.5 90 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 59 103 SUPER(HUDEnemyHealthBar, tick, dt); 60 104 } … … 71 115 target = target->getParent(); 72 116 pawn = orxonox_cast<Pawn*>(target); 117 118 73 119 // Don't show the HealthBar if the pawn is invisible 74 120 if (pawn && !pawn->isVisible()) 75 121 pawn = NULL; 76 122 } 123 77 124 // Set the pawn as owner of the HealthBar 78 125 this->setHealthBarOwner(pawn);
Note: See TracChangeset
for help on using the changeset viewer.