Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 2, 2011, 2:18:04 PM (13 years ago)
Author:
dboehi
Message:

Changed the camera shake effect to work with the updated boost code.

Location:
code/branches/gameimmersion
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gameimmersion

  • code/branches/gameimmersion/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8254 r8379  
    5555        this->localAngularAcceleration_.setValue(0, 0, 0);
    5656        this->bBoost_ = false;
    57         this->bPermanentBoost_ = false;
    5857        this->steering_ = Vector3::ZERO;
    5958        this->engine_ = 0;
     
    8382        this->cameraOriginalOrientation = c->getOrientation();
    8483
    85         this->shakeFrequency_ = 20;
     84        this->shakeFrequency_ = 50;
    8685        this->shakeAmplitude_ = 40;
    8786        this->shakeDt_ = 0;
     
    114113        registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
    115114        registerVariable(this->rotationThrust_, VariableDirection::ToClient);
     115        registerVariable(this->boostPower_, VariableDirection::ToClient);
     116        registerVariable(this->boostPowerRate_, VariableDirection::ToClient);
     117        registerVariable(this->boostRate_, VariableDirection::ToClient);
     118        registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient);
    116119    }
    117120
     
    163166
    164167
    165         Camera* c = this->getCamera();
     168
    166169            if(this->bBoost_)
    167170            {
     
    177180                {
    178181                        this->shakeDt_ += dt;
     182                       
     183                        Camera* c = this->getCamera();
    179184
    180185                        //Shaking Camera effect
     
    201206                }
    202207            }
    203             else
    204             {
    205                     //reset the camera, if the boost is not active
    206                     //TODO: don't call this every tick
    207                     this->resetCamera();
    208             }
    209208        }
    210209    }
     
    254253    }
    255254
    256     // TODO: something seems to call this function every tick, could probably handled a little more efficiently!
    257     void SpaceShip::setBoost(bool bBoost)
    258     {
    259         if(bBoost == this->bBoost_)
    260             return;
    261 
    262         if(bBoost)
    263             this->boost();
    264         else
    265         {
     255    void SpaceShip::fire()
     256    {
     257    }
     258
     259    /**
     260    @brief
     261        Starts or stops boosting.
     262    @param bBoost
     263        Whether to start or stop boosting.
     264    */
     265    void SpaceShip::boost(bool bBoost)
     266    {
     267        Camera* c = this->getCamera();
     268       
     269        if(bBoost && !this->bBoostCooldown_)
     270            this->bBoost_ = true;
     271        if(!bBoost)
     272        {
    266273            this->bBoost_ = false;
    267         }
    268     }
    269 
    270     void SpaceShip::fire()
    271     {
    272     }
    273 
    274     void SpaceShip::boost()
    275     {
    276         if(!this->bBoostCooldown_)
    277             this->bBoost_ = true;
     274            this->resetCamera();
     275        }
    278276    }
    279277
     
    326324           
    327325            assert(c != 0);
     326         
     327            if (c == 0)
     328            {
     329                    COUT(2) << "Failed to reset camera!";
     330                    return;
     331            }
     332           
     333            shakeDt_ = 0;
    328334           
    329335            c->setAngularVelocity(Vector3(0,0,0));
Note: See TracChangeset for help on using the changeset viewer.