Changeset 3065
- Timestamp:
- May 25, 2009, 6:03:56 PM (16 years ago)
- Location:
- code/branches/particles/src/orxonox/objects/worldentities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/particles/src/orxonox/objects/worldentities/BigExplosion.cc
r3054 r3065 34 34 #include <OgreParticleSystem.h> 35 35 #include <OgreSceneNode.h> 36 #include <sstream> 36 37 37 38 #include "core/Core.h" 38 39 #include "core/CoreIncludes.h" 39 40 #include "core/Executor.h" 41 #include "core/CommandExecutor.h" 40 42 #include "objects/Scene.h" 41 43 #include "tools/ParticleInterface.h" … … 53 55 if ( Core::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) ) 54 56 ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given."); 55 57 /* 58 this->cps_ = 1; 59 this->firstTick_ = true; 60 */ 56 61 this->bStop_ = false; 57 62 this->LOD_ = LODParticle::normal; 63 64 /* this->stf_ = "setTimeFactor "; 65 this->timeFactor_ = 1; 66 std::ostringstream o; 67 o << stf_ << this->timeFactor_; 68 CommandExecutor::execute(o.str() ,false); 69 this->timeFactor_ = 0.1; 70 */ 58 71 59 72 if ( Core::showsGraphics() ) … … 146 159 this->debris2_->setMeshSource("WingDebris1.mesh"); 147 160 this->debris3_->setMeshSource("BodyDebris1.mesh"); 148 this->debris4_->setMeshSource("WingDebris 1.mesh");161 this->debris4_->setMeshSource("WingDebris2.mesh"); 149 162 150 163 this->debrisEntity1_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100)); 151 this->debrisEntity1_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree( 1000).valueRadians());164 this->debrisEntity1_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians()); 152 165 this->debrisEntity1_->setScale(4); 153 166 154 167 this->debrisEntity2_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100)); 155 this->debrisEntity2_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree( 1000).valueRadians());168 this->debrisEntity2_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians()); 156 169 this->debrisEntity2_->setScale(4); 157 170 158 171 this->debrisEntity3_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100)); 159 this->debrisEntity3_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree( 1000).valueRadians());172 this->debrisEntity3_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians()); 160 173 this->debrisEntity3_->setScale(4); 161 174 162 175 this->debrisEntity4_->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(50,100)); 163 this->debrisEntity4_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree( 1000).valueRadians());176 this->debrisEntity4_->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians()); 164 177 this->debrisEntity4_->setScale(4); 165 178 … … 189 202 190 203 191 for(int i=0;i< 50;i++)204 for(int i=0;i<10;i++) 192 205 { 193 206 Identifier* idf1 = Class(Model); … … 209 222 210 223 partEntity1->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10,100)); 211 partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree( 1000).valueRadians());212 partEntity1->setScale( 2);224 partEntity1->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians()); 225 partEntity1->setScale(rnd(1, 3)); 213 226 214 227 partEntity2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 100)); 215 partEntity2->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree( 1000).valueRadians());216 partEntity2->setScale( 2);228 partEntity2->setAngularVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)).normalisedCopy() * Degree(400).valueRadians()); 229 partEntity2->setScale(rnd(1, 3)); 217 230 218 231 part1->setMeshSource("SmallPart1.mesh"); 219 232 part2->setMeshSource("SmallPart2.mesh"); 233 220 234 221 235 partEntity1->attach(part1); … … 245 259 BigExplosion::~BigExplosion() 246 260 { 261 CommandExecutor::execute("setTimeFactor 1", false); 262 247 263 if (this->isInitialized()) 248 264 { … … 362 378 } 363 379 380 /* TODO 381 382 void BigExplosion::setDebrisMeshes() 383 { 384 385 } 386 void BigExplosion::getDebrisMeshes() 387 { 388 389 } 390 */ 391 364 392 void BigExplosion::tick(float dt) 365 393 { 366 367 368 // static const unsigned int CHANGES_PER_SECOND = 5; 369 // 370 // if (Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND) 371 // { 372 // Vector3 velocity = this->object2_->getVelocity(); 373 // velocity /= 1.5; 374 // this->object2_->setVelocity(velocity); 375 // } 394 // static const unsigned int CHANGES_PER_SECOND = 10; 395 396 397 /* if (Core::isMaster() && rnd() < dt*(this->cps_)) 398 { 399 400 if(this->timeFactor_ < 1 ) 401 this->timeFactor_ += 0.05; 402 403 if(this->firstTick_) 404 this->cps_ = 256; 405 406 std::ostringstream o; 407 o << this->stf_ << this->timeFactor_; 408 CommandExecutor::execute(o.str() ,false); 409 if(this->cps_>50) 410 this->cps_/=2; 411 this->firstTick_ = false; 412 COUT(0) << timeFactor_ << std::endl; 413 } 414 */ 376 415 377 416 SUPER(BigExplosion, tick, dt); -
code/branches/particles/src/orxonox/objects/worldentities/BigExplosion.h
r3054 r3065 31 31 32 32 #include "OrxonoxPrereqs.h" 33 #include <string> 34 33 35 34 36 #include "MovableEntity.h" … … 60 62 void initZero(); 61 63 64 62 65 bool bStop_; 66 bool firstTick_; 67 68 std::string stf_; 69 70 unsigned int cps_; 71 72 double timeFactor_; 63 73 64 74 StaticEntity* explosion_; … … 73 83 Model* debris3_; 74 84 Model* debris4_; 85 86 75 87 76 88 ParticleInterface* debrisSmoke1_;
Note: See TracChangeset
for help on using the changeset viewer.