Changeset 6149
- Timestamp:
- Nov 25, 2009, 4:20:05 PM (15 years ago)
- Location:
- code/branches/presentation2
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation2/data/defaultConfig/keybindings.ini
r6108 r6149 147 147 148 148 [MouseButtons] 149 MouseButton3= 150 MouseButton4= 151 MouseButton5= 152 MouseButton6= 153 MouseButton7= 154 MouseLeft="fire 0" 155 MouseMiddle= 156 MouseRight="fire 1" 157 MouseWheel1Down= 158 MouseWheel1Up= 159 MouseWheel2Down= 160 MouseWheel2Up= 149 Button3= 150 Button4= 151 Button5= 152 Button6= 153 Button7= 161 154 Left="fire 0" 155 Middle= 162 156 Right="fire 1" 157 Wheel1Down="NewHumanController decelerate" 158 Wheel1Up="NewHumanController accelerate" 159 Wheel2Down= 160 Wheel2Up= 163 161 164 162 [MouseAxes] -
code/branches/presentation2/src/orxonox/controllers/HumanController.cc
r6108 r6149 95 95 } 96 96 97 void HumanController:: moveFrontBack(const Vector2& value)97 void HumanController::frontback(const Vector2& value) 98 98 { 99 99 if (HumanController::localController_s && HumanController::localController_s->controllableEntity_) -
code/branches/presentation2/src/orxonox/controllers/HumanController.h
r6108 r6149 45 45 virtual void tick(float dt); 46 46 47 static void moveFrontBack(const Vector2& value) ;47 static void moveFrontBack(const Vector2& value){ HumanController::localController_s->frontback(value); } 48 48 static void moveRightLeft(const Vector2& value); 49 49 static void moveUpDown(const Vector2& value); … … 52 52 static void rotatePitch(const Vector2& value){ HumanController::localController_s->pitch(value); } 53 53 static void rotateRoll(const Vector2& value); 54 54 55 virtual void frontback(const Vector2& value); 55 56 virtual void yaw(const Vector2& value); 56 57 virtual void pitch(const Vector2& value); -
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 } -
code/branches/presentation2/src/orxonox/controllers/NewHumanController.h
r6120 r6149 32 32 #include "OrxonoxPrereqs.h" 33 33 34 #include "util/Math.h" 35 34 36 #include "core/ClassTreeMask.h" 35 37 #include "HumanController.h" … … 45 47 virtual void tick(float dt); 46 48 49 virtual void frontback(const Vector2& value); 47 50 virtual void yaw(const Vector2& value); 48 51 virtual void pitch(const Vector2& value); 52 53 static void accelerate(); 54 static void decelerate(); 49 55 50 56 virtual void doFire(unsigned int firemode); 51 57 52 58 static void changeMode(); 53 59 54 60 virtual void changedControllableEntity(); 55 61 56 62 protected: 57 63 void updateTarget(); 58 64 59 65 unsigned int controlMode_; 60 66 static NewHumanController* localController_s; … … 64 70 OrxonoxOverlay* crossHairOverlay_; 65 71 float overlaySize_; 72 float currentAcceleration_; 73 float acceleration_; 66 74 ClassTreeMask targetMask_; 67 75 };
Note: See TracChangeset
for help on using the changeset viewer.