[Orxonox-commit 1439] r6157 - code/branches/presentation2/src/orxonox/controllers

scheusso at orxonox.net scheusso at orxonox.net
Thu Nov 26 09:58:16 CET 2009


Author: scheusso
Date: 2009-11-26 09:58:16 +0100 (Thu, 26 Nov 2009)
New Revision: 6157

Modified:
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
Log:
fix in NewHumanController which caused the spaceship to shoot always to the origin of universe if in mouslook mode (and if the spaceship hasn't shot before)


Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-11-25 21:59:42 UTC (rev 6156)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-11-26 08:58:16 UTC (rev 6157)
@@ -97,6 +97,7 @@
         {
             if( this->controllableEntity_ && !this->controllableEntity_->isInMouseLook() )
             {
+                this->updateTarget();
                 this->crossHairOverlay_->setPosition(Vector2(static_cast<float>(this->currentYaw_)/2*-1+.5-overlaySize_/2, static_cast<float>(this->currentPitch_)/2*-1+.5-overlaySize_/2));
                 this->crossHairOverlay_->show();
             }
@@ -144,17 +145,14 @@
         }
 */
 
-        if (firemode == 1 && this->controlMode_ == 1) {
+        if (firemode == 1 && this->controlMode_ == 1)
+        {
             //unlocked steering, steer on right mouse click
             HumanController::yaw(Vector2(this->currentYaw_, 0));
             HumanController::pitch(Vector2(this->currentPitch_, 0));
         }
-        else {
-            if( !NewHumanController::localController_s->getControllableEntity()->isInMouseLook() )
-                this->updateTarget();
-
+        else
             HumanController::localController_s->getControllableEntity()->fire(firemode);
-        }
 
     }
 
@@ -284,7 +282,8 @@
 
     void NewHumanController::accelerate()
     {
-        if ( NewHumanController::localController_s ) {
+        if ( NewHumanController::localController_s )
+        {
             NewHumanController::localController_s->acceleration_ += 0.08;
             NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ + 0.08f, 0.0f, 1.0f);
         }
@@ -292,7 +291,8 @@
 
     void NewHumanController::decelerate()
     {
-        if ( NewHumanController::localController_s ) {
+        if ( NewHumanController::localController_s )
+        {
             NewHumanController::localController_s->acceleration_ = clamp(NewHumanController::localController_s->acceleration_ - 0.05f, 0.0f, 1.0f);
         }
     }




More information about the Orxonox-commit mailing list