- Timestamp:
- Nov 25, 2009, 4:20:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
r6144 r6149 47 47 { 48 48 SetConsoleCommand(NewHumanController, changeMode, false).keybindMode(KeybindMode::OnPress); 49 SetConsoleCommand(NewHumanController, accelerate, false).keybindMode(KeybindMode::OnPress); 50 SetConsoleCommand(NewHumanController, decelerate, false).keybindMode(KeybindMode::OnPress); 49 51 50 52 CreateUnloadableFactory(NewHumanController); … … 60 62 overlaySize_ = 0.08; 61 63 controlMode_ = 0; 64 acceleration_ = 0; 65 66 //currentPitch_ = 1; 67 //currentYaw_ = 1; 62 68 63 69 if (GameMode::showsGraphics()) … … 98 104 this->crossHairOverlay_->hide(); 99 105 // TODO: update aimPosition of Pawn 106 107 if ( this->acceleration_ > 0 ) 108 HumanController::moveFrontBack(Vector2(clamp(this->acceleration_ + this->currentAcceleration_, 0.0f, 1.0f), 0)); 100 109 } 101 110 … … 230 239 } 231 240 241 void NewHumanController::frontback(const Vector2& value) 242 { 243 this->currentAcceleration_ = value.x; 244 245 if (this->acceleration_ == 0) 246 HumanController::frontback(value); 247 } 248 232 249 void NewHumanController::yaw(const Vector2& value) 233 250 { … … 248 265 } 249 266 250 void NewHumanController::changeMode() { 267 void NewHumanController::changeMode() 268 { 251 269 if (NewHumanController::localController_s && NewHumanController::localController_s->controlMode_ == 0) 252 270 { … … 264 282 this->currentPitch_ = 0; 265 283 } 284 285 void NewHumanController::accelerate() 286 { 287 if ( NewHumanController::localController_s ) { 288 NewHumanController::localController_s->acceleration_ += 0.08; 289 NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ + 0.08f, 0.0f, 1.0f); 290 } 291 } 292 293 void NewHumanController::decelerate() 294 { 295 if ( NewHumanController::localController_s ) { 296 NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ - 0.05f, 0.0f, 1.0f); 297 } 298 } 266 299 }
Note: See TracChangeset
for help on using the changeset viewer.