Changeset 8427 for code/branches
- Timestamp:
- May 9, 2011, 3:19:22 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc
r8379 r8427 142 142 if (this->hasLocalController()) 143 143 { 144 144 145 /* 145 146 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_); … … 165 166 } 166 167 168 // COUT(0) << "Velocity: " << this->getVelocity().length() << " - " << this->getVelocity().squaredLength() << std::endl; 167 169 168 170 … … 172 174 if(this->boostPower_ <= 0.0f) 173 175 { 174 this->b Boost_ = false;176 this->boost(false); 175 177 this->bBoostCooldown_ = true; 176 178 this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this))); 177 179 178 180 } 179 else181 if (this->getVelocity().squaredLength() > 20) 180 182 { 181 183 this->shakeDt_ += dt; 182 184 183 185 Camera* c = this->getCamera(); 186 187 this->shakeFrequency_ = this->getVelocity().squaredLength() / 10000; 188 189 COUT(0) << "ShakeFrequency: " << this->shakeFrequency_ << std::endl; 184 190 185 191 //Shaking Camera effect 186 192 if (c != 0) 187 193 { 188 189 if (c->getAngularVelocity() == Vector3(0,0,0)) 190 { 191 c->setAngularVelocity(Vector3(2,0,0)); 194 c->setAngularVelocity(Vector3(shakeFrequency_,0 , 0)); 195 196 //if (c->getAngularVelocity() == Vector3(0,0,0)) 197 //{ 198 // c->setAngularVelocity(Vector3(2,0,0)); 192 199 193 200 //set the delta to half the period time, 194 201 //so the camera shakes up and down. 195 this->shakeDt_ = 1/(2 * this->shakeFrequency_);196 }202 // this->shakeDt_ = 1/(2 * this->shakeFrequency_); 203 //} 197 204 198 205 … … 209 216 } 210 217 218 211 219 void SpaceShip::boostCooledDown(void) 212 220 { … … 264 272 */ 265 273 void SpaceShip::boost(bool bBoost) 266 { 267 Camera* c = this->getCamera(); 268 274 { 269 275 if(bBoost && !this->bBoostCooldown_) 270 276 this->bBoost_ = true; 271 277 if(!bBoost) 272 278 { 279 this->resetCamera(); 273 280 this->bBoost_ = false; 274 this->resetCamera();275 281 } 276 282 } … … 321 327 void SpaceShip::resetCamera() 322 328 { 329 //COUT(0) << "Resetting camera\n"; 323 330 Camera *c = this->getCamera(); 324 325 assert(c != 0);326 331 327 332 if (c == 0)
Note: See TracChangeset
for help on using the changeset viewer.