Changeset 8541 for code/branches
- Timestamp:
- May 23, 2011, 3:50:13 PM (14 years ago)
- Location:
- code/branches/gameimmersion
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gameimmersion/data/defaultConfig/keybindings.ini
r8079 r8541 21 21 KeyDown="scale -1 moveFrontBack" 22 22 KeyE="scale -1 rotateRoll" 23 KeyEnd= boost23 KeyEnd= 24 24 KeyEquals= 25 25 KeyEscape="keyESC" … … 120 120 KeySlash= 121 121 KeySleep= 122 KeySpace= boost122 KeySpace=startBoost | stopBoost 123 123 KeyStop= 124 124 KeySystemRequest= -
code/branches/gameimmersion/data/levels/templates/spaceshipImmTest.oxt
r8395 r8541 20 20 linearDamping = 0.7 21 21 angularDamping = 0.9999999 22 23 shakeFrequency = 15 22 24 > 23 25 <attached> -
code/branches/gameimmersion/src/orxonox/controllers/HumanController.cc
r8379 r8541 52 52 SetConsoleCommand("HumanController", __CC_fire_name, &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold); 53 53 SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut(); 54 SetConsoleCommand("HumanController", __CC_boost_name, &HumanController::toggleBoost ).addShortcut().keybindMode(KeybindMode::OnPress); 54 //SetConsoleCommand("HumanController", __CC_boost_name, &HumanController::toggleBoost ).addShortcut().keybindMode(KeybindMode::OnPress); 55 SetConsoleCommand("HumanController", "startBoost", &HumanController::startBoost ).addShortcut().keybindMode(KeybindMode::OnPress); 56 SetConsoleCommand("HumanController", "stopBoost", &HumanController::stopBoost ).addShortcut().keybindMode(KeybindMode::OnRelease); 55 57 SetConsoleCommand("HumanController", "greet", &HumanController::greet ).addShortcut(); 56 58 SetConsoleCommand("HumanController", "switchCamera", &HumanController::switchCamera ).addShortcut(); … … 171 173 /*static*/ void HumanController::toggleBoost() 172 174 { 175 COUT(0) << "Toggling boost!"; 173 176 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 174 177 HumanController::localController_s->toggleBoosting(); … … 182 185 void HumanController::toggleBoosting(void) 183 186 { 187 /* 184 188 this->boosting_ = !this->boosting_; 185 189 … … 190 194 ModifyConsoleCommand(__CC_boost_name).keybindMode(KeybindMode::OnPress); 191 195 192 this->controllableEntity_->boost(this->boosting_); 193 } 196 this->controllableEntity_->boost(this->boosting_);*/ 197 } 198 199 void HumanController::startBoost() 200 { 201 COUT(0) << "Starting boost" << std::endl; 202 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 203 HumanController::localController_s->setBoost(true); 204 } 205 206 void HumanController::stopBoost() 207 { 208 COUT(0) << "Stopping boost" << std::endl; 209 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) 210 HumanController::localController_s->setBoost(false); 211 } 212 213 void HumanController::setBoost(bool bBoost) 214 { 215 this->controllableEntity_->boost(bBoost); 216 } 194 217 195 218 void HumanController::greet() -
code/branches/gameimmersion/src/orxonox/controllers/HumanController.h
r8379 r8541 64 64 static void reload(); 65 65 66 static void startBoost(); 67 static void stopBoost(); 66 68 static void toggleBoost(); // Static method,toggles boosting. 69 void setBoost(bool); 67 70 /** 68 71 @brief Check whether the HumanController is in boosting mode. -
code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc
r8490 r8541 168 168 } 169 169 170 // COUT(0) << "Velocity: " << this->getVelocity().length() << " - " << this->getVelocity().squaredLength() << std::endl;171 172 173 170 if(this->bBoost_) 174 171 { … … 186 183 } 187 184 } 185 186 void SpaceShip::moveFrontBack(const Vector2& value) 187 { 188 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x); 189 this->steering_.z = -value.x; 190 } 191 192 void SpaceShip::moveRightLeft(const Vector2& value) 193 { 194 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x); 195 this->steering_.x = value.x; 196 } 197 198 void SpaceShip::moveUpDown(const Vector2& value) 199 { 200 this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x); 201 this->steering_.y = value.x; 202 } 203 204 void SpaceShip::rotateYaw(const Vector2& value) 205 { 206 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x); 207 208 Pawn::rotateYaw(value); 209 } 210 211 void SpaceShip::rotatePitch(const Vector2& value) 212 { 213 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x); 214 215 Pawn::rotatePitch(value); 216 } 217 218 void SpaceShip::rotateRoll(const Vector2& value) 219 { 220 this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x); 221 222 Pawn::rotateRoll(value); 223 } 224 225 void SpaceShip::fire() 226 { 227 } 228 229 /** 230 @brief 231 Starts or stops boosting. 232 @param bBoost 233 Whether to start or stop boosting. 234 */ 235 void SpaceShip::boost(bool bBoost) 236 { 237 if(bBoost && !this->bBoostCooldown_) 238 { 239 //COUT(0) << "Boost startet!\n"; 240 this->bBoost_ = true; 241 } 242 if(!bBoost) 243 { 244 //COUT(0) << "Boost stoppt\n"; 245 this->resetCamera(); 246 this->bBoost_ = false; 247 } 248 } 249 250 void SpaceShip::boostCooledDown(void) 251 { 252 this->bBoostCooldown_ = false; 253 } 188 254 189 255 void SpaceShip::shakeCamera(float dt) 190 256 { 257 //make sure the ship is only shaking if it's moving 191 258 if (this->getVelocity().squaredLength() > 80) 192 259 { … … 208 275 if (c != 0) 209 276 { 210 c->setOrientation(Vector3::UNIT_X, angle);277 c->setOrientation(Vector3::UNIT_X, angle); 211 278 } 212 279 } 213 280 } 214 215 216 void SpaceShip::boostCooledDown(void) 217 { 218 this->bBoostCooldown_ = false; 219 } 220 221 void SpaceShip::moveFrontBack(const Vector2& value) 222 { 223 this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x); 224 this->steering_.z = -value.x; 225 } 226 227 void SpaceShip::moveRightLeft(const Vector2& value) 228 { 229 this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x); 230 this->steering_.x = value.x; 231 } 232 233 void SpaceShip::moveUpDown(const Vector2& value) 234 { 235 this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x); 236 this->steering_.y = value.x; 237 } 238 239 void SpaceShip::rotateYaw(const Vector2& value) 240 { 241 this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x); 242 243 Pawn::rotateYaw(value); 244 } 245 246 void SpaceShip::rotatePitch(const Vector2& value) 247 { 248 this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x); 249 250 Pawn::rotatePitch(value); 251 } 252 253 void SpaceShip::rotateRoll(const Vector2& value) 254 { 255 this->localAngularAcceleration_.setZ(this->localAngularAcceleration_.z() + value.x); 256 257 Pawn::rotateRoll(value); 258 } 259 260 void SpaceShip::fire() 261 { 262 } 263 264 /** 265 @brief 266 Starts or stops boosting. 267 @param bBoost 268 Whether to start or stop boosting. 269 */ 270 void SpaceShip::boost(bool bBoost) 271 { 272 if(bBoost && !this->bBoostCooldown_) 273 { 274 // COUT(0) << "Boost startet!\n"; 275 this->bBoost_ = true; 276 } 277 if(!bBoost) 278 { 279 // COUT(0) << "Boost stoppt\n"; 280 this->resetCamera(); 281 this->bBoost_ = false; 282 } 281 282 void SpaceShip::resetCamera() 283 { 284 285 // COUT(0) << "Resetting camera\n"; 286 Camera *c = this->getCamera(); 287 288 if (c == 0) 289 { 290 COUT(2) << "Failed to reset camera!"; 291 return; 292 } 293 294 shakeDt_ = 0; 295 // 296 c->setPosition(this->cameraOriginalPosition); 297 c->setOrientation(this->cameraOriginalOrientation); 283 298 } 284 299 … … 326 341 } 327 342 328 void SpaceShip::resetCamera() 329 { 330 331 // COUT(0) << "Resetting camera\n"; 332 Camera *c = this->getCamera(); 333 334 if (c == 0) 335 { 336 COUT(2) << "Failed to reset camera!"; 337 return; 338 } 339 340 shakeDt_ = 0; 341 // 342 c->setPosition(this->cameraOriginalPosition); 343 c->setOrientation(this->cameraOriginalOrientation); 344 } 343 345 344 }
Note: See TracChangeset
for help on using the changeset viewer.