Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8583 for code


Ignore:
Timestamp:
May 25, 2011, 10:52:36 PM (14 years ago)
Author:
dafrick
Message:

Fixing possible bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/worldentities/pawns/SpaceShip.cc

    r8582 r8583  
    262262    {
    263263        //make sure the ship is only shaking if it's moving
    264         if (this->getVelocity().squaredLength() > 80)
     264        if (this->getVelocity().squaredLength() > 80.0f)
    265265        {
    266266            this->shakeDt_ += dt;
    267267   
    268             int frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
    269    
    270             if (this->shakeDt_ >= 1 /(frequency))
    271             {
    272                 this->shakeDt_ -= 1/(frequency);
    273             }
    274    
    275             Degree angle = Degree(sin(this->shakeDt_ * 2* math::pi * frequency) * this->shakeAmplitude_);
     268            float frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
     269   
     270            if (this->shakeDt_ >= 1.0f/frequency)
     271            {
     272                this->shakeDt_ -= 1.0f/frequency;
     273            }
     274   
     275            Degree angle = Degree(sin(this->shakeDt_ *2.0f* math::pi * frequency) * this->shakeAmplitude_);
    276276   
    277277            //COUT(0) << "Angle: " << angle << std::endl;
Note: See TracChangeset for help on using the changeset viewer.