- Timestamp:
- Dec 21, 2009, 1:18:36 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
r6383 r6387 58 58 this->bDestroy_ = false; 59 59 this->lifetime_ = 100; 60 60 61 61 if (GameMode::isMaster()) 62 62 { 63 63 this->setCollisionType(WorldEntity::Kinematic); 64 64 this->setVelocity(0,0,-100); 65 65 66 66 Model* model = new Model(this); 67 67 model->setMeshSource("rocket.mesh"); … … 72 72 fire->setOrientation(this->getOrientation()); 73 73 fire->setSource("Orxonox/rocketfire"); 74 74 75 75 this->enableCollisionCallback(); 76 76 this->setCollisionResponse(false); … … 83 83 84 84 this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this))); 85 85 86 86 this->defSndWpnEngine_ = new WorldSound(this); 87 87 this->defSndWpnEngine_->setLooping(true); … … 99 99 this->defSndWpnLaunch_ = 0; 100 100 } 101 101 102 102 CameraPosition* camPosition = new CameraPosition(this); 103 103 camPosition->setPosition(0,4,15); … … 134 134 SUPER(Rocket, XMLPort, xmlelement, mode); 135 135 } 136 136 137 137 void Rocket::setOwner(Pawn* owner) 138 138 { … … 158 158 { 159 159 SUPER(Rocket, tick, dt); 160 160 161 161 if( this->hasLocalController() ) 162 162 { … … 164 164 this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() ); 165 165 this->localAngularVelocity_ = 0; 166 166 167 167 if( this->bDestroy_ ) 168 168 this->destroy(); 169 169 } 170 170 } 171 171 172 172 bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 173 173 { … … 176 176 if (otherObject == this->owner_) 177 177 return false; 178 178 179 179 this->bDestroy_ = true; 180 180 … … 211 211 return false; 212 212 } 213 213 214 214 void Rocket::destroyObject() 215 215 { … … 223 223 } 224 224 } 225 225 226 226 void Rocket::fired(unsigned int firemode) 227 227 { … … 258 258 { 259 259 ControllableEntity::rotateYaw(value); 260 260 261 261 if( !this->isInMouseLook() ) 262 262 this->localAngularVelocity_.y += value.x; … … 272 272 { 273 273 ControllableEntity::rotatePitch(value); 274 274 275 275 if( !this->isInMouseLook() ) 276 276 this->localAngularVelocity_.x += value.x; … … 286 286 { 287 287 ControllableEntity::rotateRoll(value); 288 288 289 289 if( !this->isInMouseLook() ) 290 290 this->localAngularVelocity_.z += value.x; 291 291 } 292 292 293 293 }
Note: See TracChangeset
for help on using the changeset viewer.