Changeset 6045 for code/branches/steering
- Timestamp:
- Nov 11, 2009, 5:39:53 PM (15 years ago)
- Location:
- code/branches/steering/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/steering/src/modules/weapons/weaponmodes/HsW01.cc
r5929 r6045 39 39 #include "weaponsystem/WeaponPack.h" 40 40 #include "weaponsystem/WeaponSystem.h" 41 #include "worldentities/WorldEntity.h" 41 42 42 43 namespace orxonox … … 110 111 model->setScale(5); 111 112 112 projectile->setOrientation(this->getMuzzleOrientation()); 113 //projectile->setOrientation(this->getMuzzleOrientation()); 114 projectile->lookAt(this->getTarget(), WorldEntity::World); 113 115 projectile->setPosition(this->getMuzzlePosition()); 114 projectile->setVelocity(this->getMuzzleDirection() * this->speed_); 116 projectile->setVelocity((projectile->getOrientation() * Vector3::UNIT_Z) * this->speed_); //getWorldOrientation?? 117 //projectile->setVelocity(this->getMuzzleDirection() * this->speed_); 115 118 116 119 projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()); -
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 } -
code/branches/steering/src/orxonox/infos/PlayerInfo.cc
r5993 r6045 138 138 assert(this->controller_); 139 139 this->controller_->setPlayer(this); 140 if (this->controllableEntity_) 140 if (this->controllableEntity_) { 141 141 this->controller_->setControllableEntity(this->controllableEntity_); 142 this->controllableEntity_->setController(this->controller_); 143 } 142 144 this->changedController(); 143 145 } … … 158 160 this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_); 159 161 160 if (this->controller_) 162 if (this->controller_) { 161 163 this->controller_->setControllableEntity(entity); 164 this->controllableEntity_->setController(this->controller_); 165 } 162 166 163 167 this->changedControllableEntity(); … … 171 175 return; 172 176 177 this->controllableEntity_->setController(0); 173 178 this->controllableEntity_ = 0; 174 179 this->controllableEntityID_ = OBJECTID_UNKNOWN; -
code/branches/steering/src/orxonox/weaponsystem/WeaponMode.h
r5929 r6045 38 38 #include "core/SubclassIdentifier.h" 39 39 #include "tools/Timer.h" 40 41 #include "weaponsystem/Weapon.h" 42 #include "weaponsystem/WeaponPack.h" 43 #include "weaponsystem/WeaponSystem.h" 44 #include "worldentities/pawns/Pawn.h" 45 #include "controllers/Controller.h" 40 46 41 47 namespace orxonox … … 125 131 { return this->mode_; } 126 132 133 inline Vector3 getTarget() 134 { return this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getController()->getTarget(); } 135 127 136 protected: 128 137 virtual void fire() = 0; -
code/branches/steering/src/orxonox/worldentities/ControllableEntity.cc
r5929 r6045 62 62 this->camera_ = 0; 63 63 this->xmlcontroller_ = 0; 64 this->controller_ = 0; 64 65 this->reverseCamera_ = 0; 65 66 this->bDestroyWhenPlayerLeft_ = false; -
code/branches/steering/src/orxonox/worldentities/ControllableEntity.h
r5929 r6045 139 139 inline Controller* getXMLController() const 140 140 { return this->xmlcontroller_; } 141 142 inline Controller* getController() const 143 { return this->controller_; } 144 inline void setController(Controller* c) 145 { this->controller_ = c; } 141 146 142 147 protected: … … 201 206 std::string cameraPositionTemplate_; 202 207 Controller* xmlcontroller_; 208 Controller* controller_; 203 209 CameraPosition* reverseCamera_; 204 210 };
Note: See TracChangeset
for help on using the changeset viewer.