Changeset 10021 for code/branches/turretFS14/src
- Timestamp:
- Apr 3, 2014, 4:04:32 PM (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
r10018 r10021 29 29 #include "Turret.h" 30 30 #include "core/CoreIncludes.h" 31 #include "OgreQuaternion.h"32 31 #include "core/XMLPort.h" 33 #include " controllers/WaypointPatrolController.h"32 #include "BulletDynamics/Dynamics/btRigidBody.h" 34 33 35 34 namespace orxonox … … 42 41 * @brief Constructor 43 42 */ 44 Turret::Turret(Context* context) : SpaceShip(context)43 Turret::Turret(Context* context) : Pawn(context) 45 44 { 46 45 RegisterObject(Turret); … … 49 48 this->maxYaw_ = 0; 50 49 this->gotOrient_ = false; 50 this->rotationThrust_ = 50; 51 52 this->localAngularAcceleration_.setValue(0, 0, 0); 51 53 } 52 54 … … 68 70 if (this->maxPitch_ >= 180) //no need to check, if the limit too big 69 71 { 70 SpaceShip::rotatePitch(value);71 return;72 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8f); 73 return; 72 74 } 73 75 … … 92 94 if ((val >= lowerBound || value.x > 0) && (val <= upperBound || value.x < 0)) 93 95 { 94 SpaceShip::rotatePitch(value);96 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8f); 95 97 } 96 98 return; … … 105 107 if (this->maxPitch_ >= 180) //no need to check, if the limit too big 106 108 { 107 SpaceShip::rotateYaw(value);108 return;109 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x*0.8f); 110 return; 109 111 } 110 112 … … 129 131 if ((val >= lowerBound || value.x > 0) && (val <= upperBound || value.x < 0)) 130 132 { 131 SpaceShip::rotateYaw(value);133 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x*0.8f); 132 134 } 133 135 return; … … 148 150 void Turret::tick(float dt) 149 151 { 152 SUPER(Turret, tick, dt); 153 150 154 if(!gotOrient_) 151 155 { … … 155 159 Quaternion drot = startOrientInv_ * this->getOrientation(); 156 160 orxout() << "Pitch: " << drot.getPitch(false).valueDegrees() << "\tYaw: " << drot.getYaw(false).valueDegrees() << "\tRoll: " << drot.getRoll(false).valueDegrees() << endl; 157 SUPER(Turret, tick, dt); 161 162 this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_; 163 this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_); 164 this->localAngularAcceleration_.setValue(0, 0, 0); 158 165 } 159 166 -
code/branches/turretFS14/src/modules/objects/Turret.h
r10018 r10021 40 40 41 41 #include "worldentities/pawns/SpaceShip.h" 42 #include "controllers/TurretController.h"43 42 44 43 namespace orxonox 45 44 { 46 class _ObjectsExport Turret : public SpaceShip45 class _ObjectsExport Turret : public Pawn 47 46 { 48 47 public: … … 74 73 Ogre::Real maxYaw_; 75 74 Quaternion startOrientInv_; 75 float rotationThrust_; 76 77 btVector3 localAngularAcceleration_; 76 78 77 79 Ogre::Real boundBetween(float val, float lowerBound, float upperBound);
Note: See TracChangeset
for help on using the changeset viewer.