Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9457 for code/branches


Ignore:
Timestamp:
Nov 19, 2012, 4:06:56 PM (12 years ago)
Author:
mottetb
Message:

getTeam doesn't work, have to find sth else

Location:
code/branches/spaceNavigation/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc

    r9450 r9457  
    3636#include <OgreTextAreaOverlayElement.h>
    3737#include <OgrePanelOverlayElement.h>
     38
     39#include <typeinfo>
    3840
    3941#include "util/Math.h"
     
    315317                    it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f);
    316318
     319                    // Make sure the overlays are shown
     320                    it->second.panel_->show();
     321                    it->second.text_->show();
     322
    317323                    // Target marker
    318                     if(it->second.selected_ && it->first->getRVOrientedVelocity().squaredLength() != 0)
     324                    const Pawn* pawn = dynamic_cast<const Pawn*>(it->first->getWorldEntity());
     325                    Pawn* humanPawn = HumanController::getLocalControllerEntityAsPawn();
     326                    // TODO : find another solution!
     327                    orxout() << "My team: " << humanPawn->getTeam() << std::endl;
     328                    orxout() << "Targets team: " << pawn->getTeam() << std::endl;
     329                    if(!it->second.selected_
     330                            || it->first->getRVVelocity().squaredLength() == 0
     331                            || pawn == NULL
     332                            || humanPawn == NULL
     333                            /*|| pawn->getTeam() == humanPawn->getTeam()*/)
     334                    {
     335                        // don't show marker for not selected enemies nor if the selected doesn't move
     336                        it->second.target_->hide();
     337                    }
     338                    else
    319339                    {
    320340                        Vector3* targetPos = this->toAimPosition(it->first);
     
    335355                        delete targetPos;
    336356                    }
    337                     else // don't show marker for not selected enemies
    338                         it->second.target_->hide();
     357
    339358                }
    340 
    341                 // Make sure the overlays are shown
    342                 it->second.panel_->show();
    343                 it->second.text_->show();
    344359            }
    345360            else // do not display on HUD
     
    403418        // Create target marker
    404419        Ogre::PanelOverlayElement* target = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton()
    405                 .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString()));
     420                    .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString()));
    406421        target->setMaterialName(TextureGenerator::getMaterialName("target.png", object->getRadarObjectColour()));
    407422        target->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);
     
    488503        Vector3 wePosition = HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition();
    489504        Vector3 targetPosition = target->getRVWorldPosition();
    490         Vector3 targetSpeed = target->getRVOrientedVelocity();
     505        Vector3 targetSpeed = target->getRVVelocity();
    491506        Vector3 relativePosition = targetPosition - wePosition; //Vector from attacker to target
    492507
    493508        float p_half = relativePosition.dotProduct(targetSpeed)/(targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_);
    494509        float time1 = -p_half + sqrt(p_half * p_half - relativePosition.squaredLength()/(targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_));
    495         orxout()<< "TIME 1: " << time1 <<endl;
    496 
    497 
    498510
    499511        // munSpeed*time = lengthBetween(wePosition, targetPosition + targetSpeed*time)
     
    510522            return NULL;
    511523        float time = (-b - sqrt(det))/(2*a);
    512         orxout()<< "TIME 2: " << time1 <<endl;
    513524        if(time < 0)
    514525            time = (-b + sqrt(det))/(2*a);
  • code/branches/spaceNavigation/src/orxonox/interfaces/RadarViewable.cc

    r9257 r9457  
    102102    }
    103103
     104    Vector3 RadarViewable::getRVVelocity() const
     105    {
     106        const WorldEntity* object = this->getWorldEntity();
     107        validate(object);
     108        return object->getVelocity();
     109    }
     110
    104111    void RadarViewable::validate(const WorldEntity* object) const
    105112    {
  • code/branches/spaceNavigation/src/orxonox/interfaces/RadarViewable.h

    r9348 r9457  
    113113        const Vector3& getRVWorldPosition() const;
    114114        Vector3 getRVOrientedVelocity() const;
     115        Vector3 getRVVelocity() const;
    115116
    116117        inline void setRadarObjectShape(Shape shape)
Note: See TracChangeset for help on using the changeset viewer.