[Orxonox-commit 2253] r6969 - in code/branches/rocket2/src/modules/weapons: . projectiles

gnadler at orxonox.net gnadler at orxonox.net
Thu May 27 15:33:15 CEST 2010


Author: gnadler
Date: 2010-05-27 15:33:15 +0200 (Thu, 27 May 2010)
New Revision: 6969

Modified:
   code/branches/rocket2/src/modules/weapons/RocketController.cc
   code/branches/rocket2/src/modules/weapons/projectiles/Rocket.cc
   code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.cc
   code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.h
Log:


Modified: code/branches/rocket2/src/modules/weapons/RocketController.cc
===================================================================
--- code/branches/rocket2/src/modules/weapons/RocketController.cc	2010-05-26 20:09:54 UTC (rev 6968)
+++ code/branches/rocket2/src/modules/weapons/RocketController.cc	2010-05-27 13:33:15 UTC (rev 6969)
@@ -79,8 +79,8 @@
 
     void RocketController::setTargetPosition()
     {
-        //this->targetPosition_=this->target_->getWorldPosition();
-        this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
+        this->targetPosition_=this->target_->getWorldPosition(); //don't really note a difference in the rocket behaviour xD
+        //this->targetPosition_ = getPredictedPosition(this->getControllableEntity()->getWorldPosition(),this->getControllableEntity()->getVelocity().length() , this->target_->getWorldPosition(), this->target_->getVelocity());
     }
     void RocketController::moveToTargetPosition()
     {

Modified: code/branches/rocket2/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/branches/rocket2/src/modules/weapons/projectiles/Rocket.cc	2010-05-26 20:09:54 UTC (rev 6968)
+++ code/branches/rocket2/src/modules/weapons/projectiles/Rocket.cc	2010-05-27 13:33:15 UTC (rev 6969)
@@ -86,11 +86,13 @@
             this->defSndWpnEngine_ = new WorldSound(this);
             this->defSndWpnEngine_->setLooping(true);
             this->defSndWpnEngine_->setSource("sounds/Rocket_engine.ogg");
+            this->defSndWpnEngine_->setVolume(100);
             this->attach(defSndWpnEngine_);
 
             this->defSndWpnLaunch_ = new WorldSound(this);
             this->defSndWpnLaunch_->setLooping(false);
             this->defSndWpnLaunch_->setSource("sounds/Rocket_launch.ogg");
+            this->defSndWpnLaunch_->setVolume(100);
             this->attach(defSndWpnLaunch_);
         }
         else

Modified: code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.cc	2010-05-26 20:09:54 UTC (rev 6968)
+++ code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.cc	2010-05-27 13:33:15 UTC (rev 6969)
@@ -57,11 +57,10 @@
 
         this->localAngularVelocity_ = 0;
         this->bDestroy_ = false;
-        this->lifetime_ = 100;
+        this->lifetime_ = 120;
         this->setMass(15);
         COUT(4) << "simplerocket constructed\n";
-        this->counter_=0;
-        this->slowing_=false;
+        this->maxLife_=90;
 
         if (GameMode::isMaster())
        {
@@ -88,29 +87,20 @@
             collisionShape->setRadius(1.5f);
             collisionShape->setHeight(200);
             this->attachCollisionShape(collisionShape);
-            
-
             this->destroyTimer_.setTimer(this->lifetime_, false, createExecutor(createFunctor(&SimpleRocket::destroyObject, this)));
         }
 
     }
    
-    void SimpleRocket::disableFire(){
-        this->setAcceleration(0,0,0);
-        this->setVelocity(Vector3(0,0,0));
-        
-        this->fire_->detachFromParent();
-        //this->fire_->setVisible(false);
 
-    }
 
 
     void SimpleRocket::tick(float dt)
     {
 
         SUPER(SimpleRocket, tick, dt);
-        counter_++;
-        if (this->getVelocity().squaredLength() >130000 && !slowing_) counter_++; //if Velocity bigger than about 360, uses a lot more "fuel" :)
+        if (this->getVelocity().squaredLength() >130000) this->maxLife_-=dt; //if Velocity bigger than about 360, uses a lot more "fuel" :)
+        
 
             this->setAngularVelocity(this->getOrientation() * this->localAngularVelocity_);
             this->setVelocity( this->getOrientation()*WorldEntity::FRONT*this->getVelocity().length() );
@@ -118,27 +108,21 @@
 
             
             if (this->fuel_) {
-                COUT(0)<<this->getVelocity().length()<<endl;
-                if (this->counter_>1000 && counter_%12==0) 
-                    
-                    if (!this->slowing_) {
-                        this->setAcceleration(this->getOrientation()*Vector3(10,10,10));
-                        this->slowing_=true;
-                    }
-
-                if (this->counter_ > 1800) 
+                if (this->destroyTimer_.getRemainingTime()<  this->lifetime_-this->maxLife_ ) 
                     this->fuel_=false;
-            }
+            } else this->disableFire();
+
             if( this->bDestroy_ )
                 this->destroy();
-            if (!this->fuel_) 
-                this->disableFire();
-        
-           
-            
-        
+                
     }
 
+    void SimpleRocket::disableFire(){
+        this->setAcceleration(0,0,0);        
+        this->fire_->detachFromParent();
+
+    }
+
     /**s
     @brief
         Destructor. Destroys controller, if present and kills sounds, if playing.
@@ -220,11 +204,6 @@
         }
     }
     
-    void SimpleRocket::setDestroy()
-    {
-        this->bDestroy_=true;
-        CCOUT(4)<<"trying to destroy";
-    }
 
     void SimpleRocket::fired(unsigned int firemode)
     {

Modified: code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.h	2010-05-26 20:09:54 UTC (rev 6968)
+++ code/branches/rocket2/src/modules/weapons/projectiles/SimpleRocket.h	2010-05-27 13:33:15 UTC (rev 6969)
@@ -130,16 +130,18 @@
             float damage_;
             bool bDestroy_;
             bool fuel_;
-            bool slowing_;
-            int counter_;
 
 
             WeakPtr<PlayerInfo> player_;
             Timer destroyTimer_;
             float lifetime_;
+            float maxLife_;
+
             ParticleEmitter* fire_;
 
 
+
+
     };
 
 }




More information about the Orxonox-commit mailing list