Changeset 6045 for code/branches/steering/src/orxonox/controllers
- Timestamp:
- Nov 11, 2009, 5:39:53 PM (15 years ago)
- Location:
- code/branches/steering/src/orxonox/controllers
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/steering/src/orxonox/controllers/Controller.cc
r5781 r6045 29 29 #include "Controller.h" 30 30 #include "core/CoreIncludes.h" 31 #include "worldentities/ControllableEntity.h" 31 32 32 33 namespace orxonox … … 45 46 { 46 47 } 48 49 Vector3 Controller::getTarget() { 50 return this->controllableEntity_->getPosition() + (this->controllableEntity_->getOrientation() * Vector3::UNIT_Z); 51 } 47 52 } -
code/branches/steering/src/orxonox/controllers/Controller.h
r5993 r6045 58 58 virtual void changedControllableEntity() {} 59 59 60 virtual Vector3 getTarget(); 61 60 62 protected: 61 63 PlayerInfo* player_; -
code/branches/steering/src/orxonox/controllers/NewHumanController.cc
r6033 r6045 57 57 overlaySize = 0.08; 58 58 59 controlMode = 0; 60 59 61 CrossHairOverlay = new OrxonoxOverlay(this); 60 62 CrossHairOverlay->setBackgroundMaterial("Orxonox/Crosshair3"); … … 110 112 */ 111 113 114 HumanController::localController_s->getControllableEntity()->fire(firemode); 115 //} 116 //} 117 } 118 119 Vector3 NewHumanController::getTarget() { 112 120 Ogre::RaySceneQuery * rsq = HumanController::localController_s->getControllableEntity()->getScene()->getSceneManager()->createRayQuery(Ogre::Ray()); 113 121 114 std::cout << "X: " << static_cast<float>(this->currentYaw_)/2*-1+.5 << " Y: " << static_cast<float>(this->currentPitch_)/2*-1+.5 << endl;122 //std::cout << "X: " << static_cast<float>(this->currentYaw_)/2*-1+.5 << " Y: " << static_cast<float>(this->currentPitch_)/2*-1+.5 << endl; 115 123 116 124 Ogre::Ray mouseRay = HumanController::localController_s->getControllableEntity()->getCamera()->getCamera()->getCameraToViewportRay(static_cast<float>(this->currentYaw_)/2*-1+.5, static_cast<float>(this->currentPitch_)/2*-1+.5); … … 119 127 rsq->setSortByDistance(true); 120 128 129 /* 130 Distance of objects: 131 ignore everything under 200 maybe even take 1000 as min distance to shoot at 132 133 shots are regularly traced and are entities!!!!!!!!! this is the biggest problem 134 they vanish only after a distance of 10'000 135 */ 136 121 137 122 138 Ogre::RaySceneQueryResult &result = rsq->execute(); 123 139 124 140 Ogre::RaySceneQueryResult::iterator itr; 125 for ( itr = result.begin(); itr != result.end(); itr++ ) 126 { 127 std::cout << "distance: " << itr->distance << " name: " << itr->movable->getName() << " type: " << itr->movable->getMovableType() << endl; 128 if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity") { 129 std::cout << " in scene" << endl; 130 itr->movable->getParentSceneNode()->showBoundingBox(true); 131 } 132 } 141 for ( itr = result.begin(); itr != result.end(); itr++ ) 142 { 143 //std::cout << "distance: " << itr->distance << " name: " << itr->movable->getName() << " type: " << itr->movable->getMovableType(); 144 if (itr->movable->isInScene() && itr->movable->getMovableType() == "Entity" && itr->distance > 500) { 145 //std::cout << " TAGGED"; 146 itr->movable->getParentSceneNode()->showBoundingBox(true); 147 std::cout << itr->movable->getParentSceneNode()->_getDerivedPosition() << endl; 148 return itr->movable->getParentSceneNode()->_getDerivedPosition(); 149 } 150 //std::cout << endl; 151 } 133 152 134 153 //if (result.front().movable->isInScene()) std::cout << "in scene" << endl; … … 136 155 //result.front().movable->setVisible(false); 137 156 138 std::cout << endl;157 //std::cout << endl; 139 158 /* 140 159 if (!result.empty()) { … … 143 162 } 144 163 */ 145 146 147 HumanController::localController_s->getControllableEntity()->fire(firemode); 148 //} 149 //} 164 return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z); 165 //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getCamera()->getCamera()->getOrientation() * Vector3::NEGATIVE_UNIT_Z); 150 166 } 151 167 -
code/branches/steering/src/orxonox/controllers/NewHumanController.h
r6033 r6045 45 45 46 46 virtual void tick(float dt); 47 47 48 48 virtual void yaw(const Vector2& value); 49 49 virtual void pitch(const Vector2& value); 50 50 51 51 virtual void doFire(unsigned int firemode); 52 53 void changeMode(unsigned int controleMode); 54 55 virtual Vector3 getTarget(); 52 56 53 57 private: … … 56 60 OrxonoxOverlay *CrossHairOverlay; 57 61 float overlaySize; 62 unsigned int controlMode; 58 63 }; 59 64 }
Note: See TracChangeset
for help on using the changeset viewer.