Changeset 8430
- Timestamp:
- May 9, 2011, 3:52:35 PM (14 years ago)
- Location:
- code/branches/steering
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/steering/data/levels/templates/spaceshipAssff.oxt
r7845 r8430 14 14 primaryThrust = 100; 15 15 auxilaryThrust = 30; 16 rotationThrust = 25; 16 rotationThrust = 60; 17 18 lift = 0.2; 19 stallSpeed = 220; 17 20 18 21 collisionType = "dynamic" -
code/branches/steering/src/orxonox/worldentities/MobileEntity.cc
r7163 r8430 83 83 this->linearVelocity_.z += this->linearAcceleration_.z * dt; 84 84 this->node_->translate(this->linearVelocity_ * dt); 85 86 85 87 86 88 // Angular part -
code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.cc
r8223 r8430 36 36 #include "core/XMLPort.h" 37 37 #include "items/Engine.h" 38 #include "util/Debug.h" 39 38 40 39 41 namespace orxonox … … 52 54 this->localLinearAcceleration_.setValue(0, 0, 0); 53 55 this->localAngularAcceleration_.setValue(0, 0, 0); 54 56 this->bBoost_ = false; 55 57 this->steering_ = Vector3::ZERO; 56 58 this->engine_ = 0; … … 63 65 this->bBoostCooldown_ = false; 64 66 67 this->lift_ = 0.2f; 68 this->stallSpeed = 220.0f; 69 65 70 this->bInvertYAxis_ = false; 66 71 … … 75 80 this->setConfigValues(); 76 81 this->registerVariables(); 77 } 82 83 84 85 86 } 78 87 79 88 SpaceShip::~SpaceShip() … … 95 104 XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode); 96 105 XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode); 106 XMLPortParamVariable(SpaceShip, "float", float_, xmlelement, mode); 107 XMLPortParamVariable(SpaceShip, "stallSpeed", stallSpeed_, xmlelement, mode); 97 108 } 98 109 … … 163 174 } 164 175 } 176 177 COUT(1) << "Vel:" << this-> getLocalVelocity().z * -1 << endl; 178 165 179 } 166 180 } … … 175 189 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x); 176 190 this->steering_.z = -value.x; 191 177 192 } 178 193 … … 181 196 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x); 182 197 this->steering_.x = value.x; 198 183 199 } 184 200 … … 187 203 this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x); 188 204 this->steering_.y = value.x; 205 206 207 208 209 189 210 } 190 211 … … 194 215 195 216 Pawn::rotateYaw(value); 217 196 218 } 197 219 198 220 void SpaceShip::rotatePitch(const Vector2& value) 199 221 { 200 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x );222 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x * 0.8); 201 223 202 224 Pawn::rotatePitch(value); 225 226 227 228 if (abs(this-> getLocalVelocity().z) < stallSpeed) {this->moveUpDown(float_*value*sqrt(abs(this-> getLocalVelocity().z)));} 229 230 231 232 203 233 } 204 234 … … 208 238 209 239 Pawn::rotateRoll(value); 240 210 241 } 211 242 -
code/branches/steering/src/orxonox/worldentities/pawns/SpaceShip.h
r8223 r8430 89 89 float boostPowerRate_; 90 90 float boostCooldownDuration_; 91 float lift_; 92 float stallSpeed_; 91 93 Vector3 steering_; 92 94 float primaryThrust_; … … 96 98 btVector3 localAngularAcceleration_; 97 99 100 101 98 102 private: 99 103 void registerVariables(); … … 101 105 102 106 void loadEngineTemplate(); 103 107 104 108 void boostCooledDown(void); 105 109
Note: See TracChangeset
for help on using the changeset viewer.