Changeset 6905 for code/branches/rocket/src/orxonox/controllers
- Timestamp:
- May 15, 2010, 6:12:13 PM (15 years ago)
- Location:
- code/branches/rocket/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/rocket/src/orxonox/controllers/DroneController.cc
r6903 r6905 49 49 assert(dynamic_cast<Drone*>(creator)!=0); 50 50 this->setControllableEntity(dynamic_cast<Drone*>(creator)); 51 this->counter=0; 51 52 } 52 53 … … 63 64 void DroneController::tick(float dt) 64 65 { 66 this->counter++; 65 67 // Place your code here: 66 68 // - steering commands … … 70 72 // - rotatePitch, rotateYaw, rotateRoll 71 73 // - apply the to myDrone (e.g. myDrone->rotateYaw(..) ) 72 73 myDrone-> rotateYaw(0.2);74 myDrone->rotatePitch(0.08); 75 myDrone->moveFrontBack(1); 74 76 75 77 } -
code/branches/rocket/src/orxonox/controllers/DroneController.h
r6778 r6905 54 54 55 55 private: 56 int counter; 56 57 }; 57 58 } -
code/branches/rocket/src/orxonox/controllers/NewHumanController.cc
r6903 r6905 574 574 } 575 575 } 576 577 Pawn* NewHumanController::getRocketTarget() {578 579 580 Ogre::RaySceneQuery * rsq = HumanController::localController_s->getControllableEntity()->getScene()->getSceneManager()->createRayQuery(Ogre::Ray());581 582 Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getOgreCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5f, static_cast<float>(this->currentPitch_)/2*-1+.5f);583 584 rsq->setRay(mouseRay);585 rsq->setSortByDistance(true);586 587 /*588 Distance of objects:589 ignore everything under 200 maybe even take 1000 as min distance to shoot at590 591 shots are regularly traced and are entities!!!!!!!!! this is the biggest problem592 they vanish only after a distance of 10'000593 */594 595 596 Ogre::RaySceneQueryResult& result = rsq->execute();597 Pawn* pawn = orxonox_cast<Pawn*>(this->getControllableEntity());598 599 Ogre::RaySceneQueryResult::iterator itr;600 for (itr = result.begin(); itr != result.end(); ++itr)601 {602 if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 500)603 {604 // Try to cast the user pointer605 WorldEntity* wePtr = dynamic_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny()));606 if (wePtr)607 {608 // go through all parents of object and look whether they are sightable or not609 bool isSightable = false;610 WorldEntity* parent = wePtr->getParent();611 while (parent)612 {613 if (this->targetMask_.isExcluded(parent->getIdentifier()))614 {615 parent = parent->getParent();616 continue;617 }618 else619 {620 isSightable = true;621 break;622 }623 }624 if (!isSightable)625 continue;626 }627 628 return dynamic_cast<Pawn*> (wePtr);629 }630 }631 }632 576 633 577 -
code/branches/rocket/src/orxonox/controllers/NewHumanController.h
r6903 r6905 67 67 virtual void doResumeControl(); 68 68 69 Pawn* getRocketTarget();70 71 69 72 70 protected:
Note: See TracChangeset
for help on using the changeset viewer.