Changeset 7163 for code/trunk/src/orxonox/controllers/NewHumanController.cc
- Timestamp:
- Aug 11, 2010, 8:55:13 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/controllers/NewHumanController.cc
r6598 r7163 217 217 if (this->getControllableEntity() && (this->getControllableEntity()->isExactlyA(ClassByString("SpaceShip")) || this->getControllableEntity()->isExactlyA(ClassByString("Rocket")))) 218 218 this->showOverlays(); 219 else if (this->getControllableEntity() && this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer"))) 220 { 221 this->showOverlays(); 222 this->hideArrows(); 223 } 219 224 220 225 this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5f-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5f-overlaySize_/2)); … … 364 369 Ogre::RaySceneQueryResult& result = rsq->execute(); 365 370 Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity()); 371 WorldEntity* myWe = static_cast<WorldEntity*>(this->getControllableEntity()); 366 372 367 373 Ogre::RaySceneQueryResult::iterator itr; 368 374 for (itr = result.begin(); itr != result.end(); ++itr) 369 375 { 370 if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 500) 376 // CCOUT(0) << "testing object as target" << endl; 377 if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" /*&& itr->distance > 500*/) 371 378 { 372 379 // Try to cast the user pointer 373 WorldEntity* wePtr = dynamic_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny())); 380 WorldEntity* wePtr; 381 try 382 { 383 wePtr = dynamic_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny())); 384 } 385 catch (...) 386 { 387 continue; 388 } 389 390 // make sure we don't shoot ourselves 391 if( wePtr==myWe ) 392 continue; 393 374 394 if (wePtr) 375 395 { … … 379 399 while (parent) 380 400 { 381 if (this->targetMask_.isExcluded(parent->getIdentifier()) )401 if (this->targetMask_.isExcluded(parent->getIdentifier()) || parent==myWe) 382 402 { 383 403 parent = parent->getParent(); … … 430 450 HumanController::yaw(value); 431 451 432 this->currentYaw_ = value.x; 452 if (this->getControllableEntity() && !this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer"))) 453 this->currentYaw_ = value.x; 433 454 } 434 455 … … 439 460 HumanController::pitch(value); 440 461 441 this->currentPitch_ = value.x; 462 if (this->getControllableEntity() && !this->getControllableEntity()->isExactlyA(ClassByString("FpsPlayer"))) 463 this->currentPitch_ = value.x; 442 464 } 443 465 … … 579 601 } 580 602 } 603 604 605 606 607 581 608 }
Note: See TracChangeset
for help on using the changeset viewer.