Changeset 9457 for code/branches
- Timestamp:
- Nov 19, 2012, 4:06:56 PM (12 years ago)
- Location:
- code/branches/spaceNavigation/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/spaceNavigation/src/modules/overlays/hud/HUDNavigation.cc
r9450 r9457 36 36 #include <OgreTextAreaOverlayElement.h> 37 37 #include <OgrePanelOverlayElement.h> 38 39 #include <typeinfo> 38 40 39 41 #include "util/Math.h" … … 315 317 it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f); 316 318 319 // Make sure the overlays are shown 320 it->second.panel_->show(); 321 it->second.text_->show(); 322 317 323 // 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 319 339 { 320 340 Vector3* targetPos = this->toAimPosition(it->first); … … 335 355 delete targetPos; 336 356 } 337 else // don't show marker for not selected enemies 338 it->second.target_->hide(); 357 339 358 } 340 341 // Make sure the overlays are shown342 it->second.panel_->show();343 it->second.text_->show();344 359 } 345 360 else // do not display on HUD … … 403 418 // Create target marker 404 419 Ogre::PanelOverlayElement* target = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 405 .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString()));420 .createOverlayElement("Panel", "HUDNavigation_targetMarker_" + getUniqueNumberString())); 406 421 target->setMaterialName(TextureGenerator::getMaterialName("target.png", object->getRadarObjectColour())); 407 422 target->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale); … … 488 503 Vector3 wePosition = HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition(); 489 504 Vector3 targetPosition = target->getRVWorldPosition(); 490 Vector3 targetSpeed = target->getRV OrientedVelocity();505 Vector3 targetSpeed = target->getRVVelocity(); 491 506 Vector3 relativePosition = targetPosition - wePosition; //Vector from attacker to target 492 507 493 508 float p_half = relativePosition.dotProduct(targetSpeed)/(targetSpeed.squaredLength() - this->currentMunitionSpeed_ * this->currentMunitionSpeed_); 494 509 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 498 510 499 511 // munSpeed*time = lengthBetween(wePosition, targetPosition + targetSpeed*time) … … 510 522 return NULL; 511 523 float time = (-b - sqrt(det))/(2*a); 512 orxout()<< "TIME 2: " << time1 <<endl;513 524 if(time < 0) 514 525 time = (-b + sqrt(det))/(2*a); -
code/branches/spaceNavigation/src/orxonox/interfaces/RadarViewable.cc
r9257 r9457 102 102 } 103 103 104 Vector3 RadarViewable::getRVVelocity() const 105 { 106 const WorldEntity* object = this->getWorldEntity(); 107 validate(object); 108 return object->getVelocity(); 109 } 110 104 111 void RadarViewable::validate(const WorldEntity* object) const 105 112 { -
code/branches/spaceNavigation/src/orxonox/interfaces/RadarViewable.h
r9348 r9457 113 113 const Vector3& getRVWorldPosition() const; 114 114 Vector3 getRVOrientedVelocity() const; 115 Vector3 getRVVelocity() const; 115 116 116 117 inline void setRadarObjectShape(Shape shape)
Note: See TracChangeset
for help on using the changeset viewer.