Changeset 6082 for code/branches/particles2/src/modules/weapons/projectiles
- Timestamp:
- Nov 17, 2009, 10:57:44 PM (15 years ago)
- Location:
- code/branches/particles2/src/modules/weapons/projectiles
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/particles2/src/modules/weapons/projectiles/Rocket.cc
r6081 r6082 55 55 this->setVelocity(0,0,-100); 56 56 this->model_ = new Model(this); 57 this->model_->setMeshSource(" can.mesh");57 this->model_->setMeshSource("rocket_test.mesh"); 58 58 this->attach(this->model_); 59 59 this->lifetime_ = 100; 60 this->bDestroy_ = false; 60 61 61 62 if (GameMode::isMaster()) … … 74 75 75 76 this->camPosition_ = new CameraPosition(this); 76 this->camPosition_->setPosition(0, 0,0);77 this->camPosition_->setPosition(0,10,40); 77 78 this->attach( this->camPosition_ ); 78 79 this->addCameraPosition( this->camPosition_ ); … … 90 91 this->model_->destroy(); 91 92 92 if (GameMode::isMaster() && this-> owner_)93 this-> owner_->getPlayer()->startControl(this->originalControllableEntity_);93 if (GameMode::isMaster() && this->player_) 94 this->player_->stopTemporaryControl(); 94 95 this->camPosition_->destroy(); 95 96 } … … 109 110 { 110 111 this->owner_ = owner; 111 112 112 113 this->originalControllableEntity_ = this->owner_->getPlayer()->getControllableEntity(); 113 this-> originalControllableEntity_->setDestroyWhenPlayerLeft( false);114 this->owner_->getPlayer()->start Control(this);114 this->player_ = this->owner_->getPlayer(); 115 this->owner_->getPlayer()->startTemporaryControl(this); 115 116 } 116 117 … … 126 127 127 128 this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_); 128 this->setVelocity( (this->getOrientation()*WorldEntity::FRONT)*100);129 this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() ); 129 130 this->localAngularVelocity_ = 0; 130 // this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_); 131 // this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_); 132 // if (this->localLinearAcceleration_.z() > 0) 133 // this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_); 134 // else 135 // this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_); 136 // this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_); 137 // this->localLinearAcceleration_.setValue(0, 0, 0); 138 // 139 // this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_; 140 // this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_); 131 132 if( this->bDestroy_ ) 133 this->destroy(); 141 134 } 142 135 … … 147 140 if (otherObject == this->owner_) 148 141 return false; 149 142 150 143 this->bDestroy_ = true; 151 144 … … 177 170 if (victim) 178 171 victim->damage(dmg, this->owner_); 172 // this->destroy(); 179 173 } 180 174 return false; … … 195 189 void Rocket::rotateYaw(const Vector2& value) 196 190 { 197 this->localAngularVelocity_.y = value.x;191 this->localAngularVelocity_.y += value.x; 198 192 } 199 193 … … 206 200 void Rocket::rotatePitch(const Vector2& value) 207 201 { 208 this->localAngularVelocity_.x = value.x;202 this->localAngularVelocity_.x += value.x; 209 203 } 210 204 … … 217 211 void Rocket::rotateRoll(const Vector2& value) 218 212 { 219 this->localAngularVelocity_.z = value.x;213 this->localAngularVelocity_.z += value.x; 220 214 } 221 215 -
code/branches/particles2/src/modules/weapons/projectiles/Rocket.h
r6079 r6082 110 110 inline float getDamage() const 111 111 { return this->damage_; } 112 virtual void fire(unsigned int firemode) { }112 virtual void fire(unsigned int firemode) { this->destroy(); } 113 113 114 114 private: … … 122 122 CameraPosition* camPosition_; 123 123 ConeCollisionShape* collisionShape_; 124 PlayerInfo* player_; 124 125 Timer destroyTimer_; 125 126 float lifetime_;
Note: See TracChangeset
for help on using the changeset viewer.