Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2014, 1:01:28 PM (10 years ago)
Author:
maxima
Message:

Branch hudHS14 merged with presentation branch

Location:
code/branches/presentationHS14
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentationHS14

  • code/branches/presentationHS14/src/modules/overlays/hud/HUDEnemyHealthBar.cc

    r9667 r10171  
    3131#include "core/config/ConfigValueIncludes.h"
    3232#include "worldentities/pawns/Pawn.h"
     33#include "graphics/Camera.h"
    3334
    3435namespace orxonox
     
    5758        this->updateTarget();
    5859
     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
    59103        SUPER(HUDEnemyHealthBar, tick, dt);
    60104    }
     
    71115                target = target->getParent();
    72116            pawn = orxonox_cast<Pawn*>(target);
     117
     118
    73119            // Don't show the HealthBar if the pawn is invisible
    74120            if (pawn && !pawn->isVisible())
    75121                pawn = NULL;
    76122        }
     123
    77124        // Set the pawn as owner of the HealthBar
    78125        this->setHealthBarOwner(pawn);
Note: See TracChangeset for help on using the changeset viewer.