Changeset 8588 for code/branches/bigships/src/orxonox/items
- Timestamp:
- May 26, 2011, 12:04:42 AM (14 years ago)
- Location:
- code/branches/bigships/src/orxonox/items
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/bigships/src/orxonox/items/Engine.cc
r8426 r8588 47 47 this->ship_ = 0; 48 48 this->shipID_ = OBJECTID_UNKNOWN; 49 49 this->relativePosition_ = Vector3(0,0,0); 50 50 51 51 this->boostFactor_ = 1.5; … … 72 72 Engine::~Engine() 73 73 { 74 if (this->isInitialized() && this->ship_) 75 { 76 //this->ship_->setEngine(0); 77 78 //if (this->boostBlur_) 79 // this->boostBlur_->destroy(); 80 } 74 81 75 } 82 76 … … 98 92 XMLPortParam(Engine, "accelerationupdown", setAccelerationUpDown, setAccelerationUpDown, xmlelement, mode); 99 93 100 101 94 XMLPortParam(Engine, "position", setRelativePosition, getRelativePosition, xmlelement, mode); 95 XMLPortParam(Engine, "template", setEngineTemplate, getEngineTemplate, xmlelement, mode); 102 96 } 103 97 … … 199 193 } 200 194 201 195 // NOTE: Bullet always uses global coordinates. 202 196 this->ship_->addAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())), this->ship_->getOrientation() * this->relativePosition_); 203 197 204 205 // Hack to reset a temporary variable "direction" 206 this->ship_->oneEngineTickDone(); 207 if(!this->ship_->hasEngineTicksRemaining()) 208 { 209 this->ship_->setSteeringDirection(Vector3::ZERO); 210 this->ship_->resetEngineTicks(); 211 } 198 // Hack to reset a temporary variable "direction" 199 this->ship_->oneEngineTickDone(); 200 if(!this->ship_->hasEngineTicksRemaining()) 201 { 202 this->ship_->setSteeringDirection(Vector3::ZERO); 203 this->ship_->resetEngineTicks(); 204 } 212 205 } 213 206 … … 247 240 } 248 241 249 250 251 252 253 254 255 256 257 258 259 260 242 void Engine::loadEngineTemplate() 243 { 244 if(!this->engineTemplate_.empty()) 245 { 246 COUT(4)<<"Loading an engine template: "<<this->engineTemplate_<<"\n"; 247 Template *temp = Template::getTemplate(this->engineTemplate_); 248 if(temp) 249 { 250 this->addTemplate(temp); 251 } 252 } 253 } 261 254 } -
code/branches/bigships/src/orxonox/items/Engine.h
r8426 r8588 55 55 { return this->ship_; } 56 56 57 58 59 60 57 inline void setRelativePosition(const Vector3 &position) 58 { this->relativePosition_ = position; } 59 inline Vector3& getRelativePosition() 60 { return this->relativePosition_; } 61 61 62 62 inline void setBoostFactor(float factor) … … 124 124 { this->speedMultiply_=speedMultiply; } 125 125 126 126 127 127 inline void setEngineTemplate(const std::string& temp) 128 128 { this->engineTemplate_ = temp; this->loadEngineTemplate(); } … … 134 134 { return new std::vector<PickupCarrier*>(); } 135 135 virtual PickupCarrier* getCarrierParent(void) const; 136 136 137 137 void loadEngineTemplate(); 138 138 … … 141 141 void networkcallback_shipID(); 142 142 143 143 std::string engineTemplate_; 144 144 145 145 SpaceShip* ship_; 146 146 unsigned int shipID_; 147 147 Vector3 relativePosition_; 148 148 149 149 float boostFactor_;
Note: See TracChangeset
for help on using the changeset viewer.