Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 24, 2009, 11:53:09 PM (15 years ago)
Author:
bknecht
Message:

introducing the bouncing pickup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/pickups2/src/orxonox/objects/pickup/PickupSpawner.cc

    r2917 r3046  
    4444namespace orxonox
    4545{
     46    const float PickupSpawner::bounceSpeed_s = 6.0f;
     47    const float PickupSpawner::rotationSpeed_s = 1.0f;
     48    const float PickupSpawner::bounceDistance_s = 4.0f;
     49
    4650    CreateFactory(PickupSpawner);
    4751
     
    5761        this->triggerDistance_ = 20;
    5862        this->respawnTime_ = 0.0f;
     63        this->tickSum_ = 0.0f;
    5964    }
    6065    //! Deconstructor.
     
    108113                    this->trigger(*it);
    109114            }
     115            this->yaw(Radian(rotationSpeed_s*dt));
     116            this->tickSum_ += bounceSpeed_s*dt;
     117            this->translate(Vector3(0,bounceDistance_s*dt*sin(this->tickSum_),0));
     118            if (this->tickSum_ > 2*Ogre::Math::PI)
     119                this->tickSum_ -= 2*Ogre::Math::PI;
    110120        }
    111121    }
Note: See TracChangeset for help on using the changeset viewer.