Changeset 6082 for code/branches
- Timestamp:
- Nov 17, 2009, 10:57:44 PM (15 years ago)
- Location:
- code/branches/particles2/src
- Files:
-
- 4 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_; -
code/branches/particles2/src/orxonox/infos/PlayerInfo.cc
r5929 r6082 163 163 this->changedControllableEntity(); 164 164 } 165 166 void PlayerInfo::startTemporaryControl(ControllableEntity* entity) 167 { 168 if (!entity || entity == this->controllableEntity_) 169 return; 170 171 // if (this->controllableEntity_) 172 // this->stopControl(); 173 174 this->oldControllableEntity_ = this->controllableEntity_; 175 176 this->controllableEntity_ = entity; 177 this->controllableEntityID_ = entity->getObjectID(); 178 179 entity->setPlayer(this); 180 181 this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_); 182 183 if (this->controller_) 184 this->controller_->setControllableEntity(entity); 185 186 this->changedControllableEntity(); 187 } 165 188 166 189 void PlayerInfo::stopControl() … … 178 201 179 202 entity->removePlayer(); 180 203 204 if ( this->oldControllableEntity_ ) 205 { 206 this->oldControllableEntity_->removePlayer(); 207 this->oldControllableEntity_ = 0; 208 } 209 210 this->changedControllableEntity(); 211 } 212 213 void PlayerInfo::stopTemporaryControl() 214 { 215 ControllableEntity* entity = this->controllableEntity_; 216 217 if (!entity) 218 return; 219 220 this->controllableEntity_ = this->oldControllableEntity_.get(); 221 this->controllableEntityID_ = this->controllableEntity_->getObjectID(); 222 223 if (this->controller_) 224 this->controller_->setControllableEntity(this->controllableEntity_); 225 226 entity->removePlayer(); 227 181 228 this->changedControllableEntity(); 182 229 } -
code/branches/particles2/src/orxonox/infos/PlayerInfo.h
r5929 r6082 69 69 void startControl(ControllableEntity* entity); 70 70 void stopControl(); 71 void startTemporaryControl(ControllableEntity* entity); 72 void stopTemporaryControl(); 71 73 72 74 inline ControllableEntity* getControllableEntity() const … … 96 98 Controller* controller_; 97 99 ControllableEntity* controllableEntity_; 100 WeakPtr<ControllableEntity> oldControllableEntity_; 98 101 unsigned int controllableEntityID_; 99 102
Note: See TracChangeset
for help on using the changeset viewer.