Changeset 8191 for code/branches/gameimmersion
- Timestamp:
- Apr 4, 2011, 4:19:57 PM (14 years ago)
- Location:
- code/branches/gameimmersion/src/orxonox/worldentities/pawns
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc
r8138 r8191 82 82 this->cameraOriginalPosition = c->getPosition(); 83 83 this->cameraOriginalOrientation = c->getOrientation(); 84 85 this->shakeFrequency_ = 100; 86 this->shakeAmplitude_ = 40; 87 this->shakeDeltaTime_ = 0; 84 88 } 85 89 … … 156 160 this->boostPower_ += this->boostPowerRate_*dt; 157 161 } 162 163 Camera* c = CameraManager::getInstance().getActiveCamera(); 158 164 if(this->bBoost_) 159 165 { 160 Camera* c = CameraManager::getInstance().getActiveCamera();161 166 this->boostPower_ -=this->boostRate_*dt; 162 167 if(this->boostPower_ <= 0.0f) … … 166 171 this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this))); 167 172 168 c->setVelocity(0,0,0);169 c->setPosition(this->cameraOriginalPosition);170 c->setOrientation(this->cameraOriginalOrientation);171 173 } 172 174 else 173 175 { 174 //Kamera schuettelt 175 COUT(1) << "Afterburner effect\n"; 176 this->shakeDeltaTime_ += dt; 177 178 //Shaking Camera effect 176 179 if (c != 0) 177 180 { 178 c->setVelocity(0.1, 2.0, 0.3); 181 182 if (c->getAngularVelocity() == Vector3(0,0,0)) 183 { 184 c->setAngularVelocity(Vector3(2,0,0)); 185 this->shakeDeltaTime_ = 0; 186 } 187 188 189 //toggle the rotation 190 if (1/(this->shakeFrequency_) <= shakeDeltaTime_) 191 { 192 c->setAngularVelocity(-c->getAngularVelocity()); 193 shakeDeltaTime_ = 0; 194 } 195 196 197 /* 198 COUT(1) << "Time since change: " << shakeDeltaTime_ << std::endl; 199 COUT(1) << "Rotation Rate: " << c->getRotationRate() << std::endl; 200 COUT(1) << "Angular Velocity: " << c->getAngularVelocity().length(); 201 COUT(1) << std::endl; 202 */ 179 203 } 180 204 } 181 205 } 206 else 207 { 208 //reset the camera, if the boost is not active 209 //TODO: don't call this every tick 210 c->setAngularVelocity(Vector3(0,0,0)); 211 c->setPosition(this->cameraOriginalPosition); 212 c->setOrientation(this->cameraOriginalOrientation); 213 } 182 214 } 183 215 } -
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.h
r8138 r8191 103 103 btVector3 localAngularAcceleration_; 104 104 105 106 float shakeFrequency_; 107 float shakeAmplitude_; 108 float shakeDeltaTime_; 109 105 110 private: 106 111 void registerVariables();
Note: See TracChangeset
for help on using the changeset viewer.