[Orxonox-commit 1397] r6115 - in code/branches/presentation2/src: modules/weapons/projectiles orxonox/controllers

scheusso at orxonox.net scheusso at orxonox.net
Sat Nov 21 12:11:25 CET 2009


Author: scheusso
Date: 2009-11-21 12:11:25 +0100 (Sat, 21 Nov 2009)
New Revision: 6115

Modified:
   code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
   code/branches/presentation2/src/orxonox/controllers/NewHumanController.h
Log:
mouselook now also working when steering a rocket


Modified: code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc	2009-11-21 00:29:48 UTC (rev 6114)
+++ code/branches/presentation2/src/modules/weapons/projectiles/Rocket.cc	2009-11-21 11:11:25 UTC (rev 6115)
@@ -62,10 +62,10 @@
         
             this->model_ = new Model(this);
             this->model_->setMeshSource("rocket.mesh");
-			this->attach(this->model_);
-			ParticleSpawner* fire = new ParticleSpawner(this);
-			this->attach(fire);
-			fire->setOrientation(this->getOrientation());
+            this->attach(this->model_);
+            ParticleSpawner* fire = new ParticleSpawner(this);
+            this->attach(fire);
+            fire->setOrientation(this->getOrientation());
             fire->setSource("Orxonox/rocketfire");
         
             this->enableCollisionCallback();
@@ -78,13 +78,12 @@
             this->attachCollisionShape(this->collisionShape_);
 
             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&Rocket::destroyObject, this)));
-               
-			
         }
         
         this->camPosition_ = new CameraPosition(this);
         this->camPosition_->setPosition(0,10,40);
         this->camPosition_->setSyncMode(0x0);
+        this->camPosition_->setAllowMouseLook(true);
         this->attach( this->camPosition_ );
         this->addCameraPosition( this->camPosition_ );
     }
@@ -97,7 +96,6 @@
     {
         if(this->isInitialized())
         {
-            
             if (GameMode::isMaster() && this->player_.get())
             {
                 this->model_->destroy();
@@ -228,7 +226,10 @@
     */
     void Rocket::rotateYaw(const Vector2& value)
     {
-        this->localAngularVelocity_.y += value.x;
+        ControllableEntity::rotateYaw(value);
+        
+        if( !this->isInMouseLook() )
+            this->localAngularVelocity_.y += value.x;
     }
 
     /**
@@ -239,7 +240,10 @@
     */
     void Rocket::rotatePitch(const Vector2& value)
     {
-        this->localAngularVelocity_.x += value.x;
+        ControllableEntity::rotatePitch(value);
+        
+        if( !this->isInMouseLook() )
+            this->localAngularVelocity_.x += value.x;
     }
 
     /**
@@ -250,7 +254,10 @@
     */
     void Rocket::rotateRoll(const Vector2& value)
     {
-        this->localAngularVelocity_.z += value.x;
+        ControllableEntity::rotateRoll(value);
+        
+        if( !this->isInMouseLook() )
+            this->localAngularVelocity_.z += value.x;
     }
     
 }

Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-11-21 00:29:48 UTC (rev 6114)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.cc	2009-11-21 11:11:25 UTC (rev 6115)
@@ -234,4 +234,11 @@
         else
             NewHumanController::localController_s->controlMode_ = 0;
     }
+    
+    void NewHumanController::changedControllableEntity()
+    {
+        this->controlMode_ = 0;
+        this->currentYaw_ = 0;
+        this->currentPitch_ = 0;
+    }
 }

Modified: code/branches/presentation2/src/orxonox/controllers/NewHumanController.h
===================================================================
--- code/branches/presentation2/src/orxonox/controllers/NewHumanController.h	2009-11-21 00:29:48 UTC (rev 6114)
+++ code/branches/presentation2/src/orxonox/controllers/NewHumanController.h	2009-11-21 11:11:25 UTC (rev 6115)
@@ -50,17 +50,19 @@
             virtual void doFire(unsigned int firemode);
 
             static void changeMode();
+            
+            virtual void changedControllableEntity();
 
         protected:
             void updateTarget();
             
             unsigned int                controlMode_;
-            static NewHumanController* localController_s;
+            static NewHumanController*  localController_s;
         private:
             float                       currentYaw_;
             float                       currentPitch_;
             OrxonoxOverlay*             crossHairOverlay_;
-            float			            overlaySize_;
+            float                       overlaySize_;
             ClassTreeMask               targetMask_;
     };
 }




More information about the Orxonox-commit mailing list