Changeset 10021 for code/branches/turretFS14
- Timestamp:
- Apr 3, 2014, 4:04:32 PM (11 years ago)
- Location:
- code/branches/turretFS14
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/turretFS14/data/levels/templates/spaceshipTurretTest.oxt
r10018 r10021 1 1 <Template name=spaceshipturrettest> 2 <SpaceShip 3 hudtemplate = spaceshiphud 4 camerapositiontemplate = spaceshipturretcameras 5 spawnparticlesource = "Orxonox/fairytwirl" 6 spawnparticleduration = 3 7 explosionchunks = 6 8 9 health = 100 10 maxhealth = 200 11 initialhealth = 100 12 13 shieldhealth = 30 14 initialshieldhealth = 30 15 maxshieldhealth = 50 16 shieldabsorption = 0.8 17 reloadrate = 1 18 reloadwaittime = 1 19 20 primaryThrust = 100 21 auxilaryThrust = 30 22 rotationThrust = 50 23 24 lift = 1; 25 stallSpeed = 220; 26 27 boostPower = 15 28 boostPowerRate = 1 29 boostRate = 5 30 boostCooldownDuration = 10 31 32 shakeFrequency = 15 33 shakeAmplitude = 9 34 35 collisionType = "dynamic" 36 mass = 100 37 linearDamping = 0.7 38 angularDamping = 0.9999999 39 > 2 <Turret position="0,0,0" collisionType="dynamic" angularDamping=0.999999 mass=100> 40 3 <attached> 41 4 <Model position="0,0,0" pitch="90" roll="0" mesh="turretHead.mesh" scale3D="10,10,10"/> … … 44 7 <SphereCollisionShape radius="10" position = "0,0,0"/> 45 8 </collisionShapes> 9 </Turret> 46 10 <?lua 47 11 include("../includes/weaponSettingsTurretTest.oxi") 48 12 ?> 49 </SpaceShip>50 13 </Template> 51 14 -
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.