Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3874 in orxonox.OLD


Ignore:
Timestamp:
Apr 18, 2005, 4:45:16 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: reimplemented the random funtions to behave between boundrarties

Location:
orxonox/trunk/src/util/animation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3872 r3874  
    304304void Animation3D::random(float timePassed) const
    305305{
    306   this->object->setRelCoor(this->currentKeyFrame->position * (float)rand()/(float)RAND_MAX);
    307   this->object->setRelDir(this->currentKeyFrame->direction * (float)rand()/(float)RAND_MAX);
    308 }
     306  this->object->setRelCoor(this->currentKeyFrame->position +
     307                           (this->nextKeyFrame->position - this->currentKeyFrame->position) * (float)rand()/(float)RAND_MAX);
     308  this->object->setRelDir(this->currentKeyFrame->direction +
     309                          (this->nextKeyFrame->direction - this->currentKeyFrame->direction)* (float)rand()/(float)RAND_MAX);
     310}
  • orxonox/trunk/src/util/animation/t_animation.h

    r3872 r3874  
    342342float tAnimation<T>::random(float timePassed) const
    343343{
    344   return this->currentKeyFrame->value * (float)rand()/(float)RAND_MAX;
     344  return this->currentKeyFrame->value +
     345    (this->nextKeyFrame->value - this->currentKeyFrame->value) *
     346    (float)rand()/(float)RAND_MAX;
    345347}
    346348
Note: See TracChangeset for help on using the changeset viewer.