Changeset 1552 for code/trunk/src/orxonox/objects/SpaceShip.cc
- Timestamp:
- Jun 6, 2008, 5:31:58 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/SpaceShip.cc
r1535 r1552 44 44 #include "core/input/InputManager.h" 45 45 #include "particle/ParticleInterface.h" 46 #include "Projectile.h"47 46 #include "RotatingProjectile.h" 47 #include "ParticleProjectile.h" 48 48 #include "core/XMLPort.h" 49 49 #include "core/ConsoleCommand.h" … … 69 69 SpaceShip* SpaceShip::instance_s; 70 70 71 71 72 72 SpaceShip *SpaceShip::getLocalShip(){ 73 73 Iterator<SpaceShip> it; … … 88 88 cam_(0), 89 89 camName_("CamNode"), 90 tt_(0), 90 tt1_(0), 91 tt2_(0), 91 92 redNode_(0), 92 93 greenNode_(0), … … 111 112 mouseX_(0.0f), 112 113 mouseY_(0.0f), 113 emitterRate_(0.0f),114 114 myShip_(false), 115 115 teamNr_(0), … … 138 138 SpaceShip::~SpaceShip() 139 139 { 140 if (this->tt_) 141 delete this->tt_; 140 if (this->tt1_) 141 delete this->tt1_; 142 if (this->tt2_) 143 delete this->tt2_; 142 144 if(setMouseEventCallback_) 143 145 InputManager::removeMouseHandler("SpaceShip"); … … 180 182 { 181 183 // START CREATING THRUSTER 182 this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow"); 183 this->tt_->getParticleSystem()->setParameter("local_space","true"); 184 this->tt_->newEmitter(); 185 /* 186 this->tt_->setDirection(Vector3(0,0,1)); 187 this->tt_->setPositionOfEmitter(0, Vector3(20,-1,-15)); 188 this->tt_->setPositionOfEmitter(1, Vector3(-20,-1,-15)); 189 */ 190 this->tt_->setDirection(Vector3(-1,0,0)); 191 this->tt_->setPositionOfEmitter(0, Vector3(-15,20,-1)); 192 this->tt_->setPositionOfEmitter(1, Vector3(-15,-20,-1)); 193 this->tt_->setVelocity(50); 194 195 emitterRate_ = tt_->getRate(); 196 197 Ogre::SceneNode* node2 = this->getNode()->createChildSceneNode(this->getName() + "particle2"); 198 node2->setInheritScale(false); 199 tt_->addToSceneNode(node2); 184 this->tt1_ = new ParticleInterface("Orxonox/thruster1"); 185 this->tt1_->createNewEmitter(); 186 this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir()); 187 this->tt1_->getEmitter(0)->setPosition(Vector3(-15, 20, -1)); 188 this->tt1_->getEmitter(1)->setPosition(Vector3(-15, -20, -1)); 189 this->tt1_->setSpeedFactor(3.0); 190 191 Ogre::SceneNode* node2a = this->getNode()->createChildSceneNode(this->getName() + "particle2a"); 192 node2a->setInheritScale(false); 193 node2a->setScale(1, 1, 1); 194 tt1_->addToSceneNode(node2a); 195 196 this->tt2_ = new ParticleInterface("Orxonox/thruster2"); 197 this->tt2_->createNewEmitter(); 198 this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0)); 199 this->tt2_->getEmitter(0)->setPosition(Vector3(-30, 40, -2)); 200 this->tt2_->getEmitter(1)->setPosition(Vector3(-30, -40, -2)); 201 202 Ogre::SceneNode* node2b = this->getNode()->createChildSceneNode(this->getName() + "particle2b"); 203 node2b->setInheritScale(false); 204 node2b->setScale(0.5, 0.5, 0.5); 205 tt2_->addToSceneNode(node2b); 200 206 // END CREATING THRUSTER 201 207 … … 266 272 this->camNode_ = this->getNode()->createChildSceneNode(camName_); 267 273 COUT(4) << "position: (this)" << this->getNode()->getPosition() << std::endl; 268 this->camNode_->setPosition(Vector3(- 50,0,10));274 this->camNode_->setPosition(Vector3(-25,0,5)); 269 275 // Quaternion q1 = Quaternion(Radian(Degree(90)),Vector3(0,-1,0)); 270 276 // Quaternion q2 = Quaternion(Radian(Degree(90)),Vector3(0,0,-1)); … … 339 345 } 340 346 341 Vector3 SpaceShip::getDir() {342 return currentDir_;343 }344 345 Vector3 SpaceShip::getOrth(){346 return currentOrth_;347 }348 349 float SpaceShip::getMaxSpeed() { return maxSpeed_; }350 351 347 void SpaceShip::tick(float dt) 352 348 { … … 374 370 { 375 371 376 Projectile *p; 377 if (this->isExactlyA(Class(SpaceShip))) 378 p = new RotatingProjectile(this); 379 else 380 p = new Projectile(this); 381 p->setColour(this->getProjectileColour()); 382 p->create(); 383 if(p->classID==0) 372 BillboardProjectile* projectile = new ParticleProjectile(this); 373 projectile->setColour(this->getProjectileColour()); 374 projectile->create(); 375 if (projectile->classID == 0) 376 { 384 377 COUT(3) << "generated projectile with classid 0" << std::endl; // TODO: remove this output 385 386 p->setBacksync(true); 378 } 379 380 projectile->setBacksync(true); 387 381 this->timeToReload_ = this->reloadTime_; 388 382 } … … 464 458 465 459 if (this->acceleration_.x > 0) 466 this->tt_->setRate(emitterRate_); 460 { 461 this->tt1_->setEnabled(true); 462 this->tt2_->setEnabled(true); 463 } 467 464 else 468 this->tt_->setRate(0); 465 { 466 this->tt1_->setEnabled(false); 467 this->tt2_->setEnabled(false); 468 } 469 469 470 470 if( myShip_ )
Note: See TracChangeset
for help on using the changeset viewer.