Changeset 10063 for code/branches/turretFS14/src
- Timestamp:
- May 20, 2014, 10:21:20 AM (11 years ago)
- Location:
- code/branches/turretFS14/src/modules/objects
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/turretFS14/src/modules/objects/Turret.cc
r10061 r10063 63 63 64 64 this->setRadarVisibility(false); 65 66 //this->rayTest_ = this->getScene()->getSceneManager()->createRayQuery(Ogre::Ray()); 65 67 } 66 68 67 69 /** 68 70 @brief 69 Destructor. Nothing to see here.71 Destructor. Destroys the rayTest_ element (if it was used) . 70 72 */ 71 73 Turret::~Turret() 72 74 { 73 75 //this->getScene()->getSceneManager()->destroyQuery(this->rayTest_); 74 76 } 75 77 … … 87 89 The squared distance to the position. -1, if it's ouside of range 88 90 */ 89 float Turret::isInRange(const WorldEntity* target ) const91 float Turret::isInRange(const WorldEntity* target ) 90 92 { 91 93 //Check distance … … 120 122 } 121 123 122 Ogre::SceneManager* scenemanager = this->getScene()->getSceneManager();123 Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance);124 Ogre::DefaultRaySceneQuery rayscenequery = Ogre::DefaultRaySceneQuery(scenemanager);125 rayscenequery.setRay(ray);126 //rayscenequery.execute(); 124 //TODO: Finish this. Find a way to convert objects from Ogre to Orxonox 125 /*Ogre::Ray ray = Ogre::Ray(this->getWorldPosition(), distance); 126 this->rayTest_->setRay(ray); 127 Ogre::RaySceneQueryResult result = this->rayTest_->execute();*/ 128 127 129 128 130 return distanceVal; … … 273 275 //Don't make the rotation instantaneous. Use an arbitrary interpolation, not that great... 274 276 //TODO: make the rotation better (constant velocity etc.). At the moment, the turret rotates 275 // 277 //slower the closer it is to the destination 276 278 Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_); 277 279 this->rotate(drot, WorldEntity::World); -
code/branches/turretFS14/src/modules/objects/Turret.h
r10060 r10063 37 37 #include "objects/ObjectsPrereqs.h" 38 38 #include "worldentities/pawns/Pawn.h" 39 #include <OgreSceneQuery.h> 39 40 40 41 namespace orxonox … … 63 64 virtual void rotateYaw(const Vector2& value); 64 65 virtual void rotateRoll(const Vector2& value); 65 virtual float isInRange(const WorldEntity* target) const;66 virtual float isInRange(const WorldEntity* target); 66 67 virtual void aimAtPosition(const Vector3 &position); 67 68 … … 119 120 Ogre::Real maxYaw_; //!< The maxmium yaw the turret can have (on one side). 120 121 float rotationThrust_; //!< The velocity the turret rotates with. 122 Ogre::RaySceneQuery* rayTest_; //!< Used to perform a raytest, currently unused @see isInRange 121 123 122 124 };
Note: See TracChangeset
for help on using the changeset viewer.