Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3984 in orxonox.OLD for orxonox/trunk/src/util/animation


Ignore:
Timestamp:
Apr 26, 2005, 3:36:56 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: implemented the sinus function for shifCoor method

File:
1 edited

Legend:

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

    r3982 r3984  
    183183    case ANIM_SINE:
    184184      this->animFuncMov = &Animation3D::mSine;
     185      this->object->setRelCoor(this->currentKeyFrame->position);
     186      this->currentKeyFrame->lastPosition = Vector();
    185187      break;
    186188    case ANIM_COSINE:
     
    242244void Animation3D::mSine(float timePassed) const
    243245{
     246  /*
    244247  if( timePassed  < this->currentKeyFrame->duration/2.0)
    245248    this->object->setRelCoor( this->currentKeyFrame->position + (this->nextKeyFrame->position - this->currentKeyFrame->position) *
     
    248251    this->object->setRelCoor( this->nextKeyFrame->position - (this->nextKeyFrame->position - this->currentKeyFrame->position) *
    249252                              sin( M_PI * (1.0 - timePassed /this->currentKeyFrame->duration) )/2.0);
     253  */
     254  Vector v;
     255  if( timePassed  < this->currentKeyFrame->duration/2.0)
     256    v = (this->nextKeyFrame->position - this->currentKeyFrame->position) * sin( M_PI * timePassed /this->currentKeyFrame->duration) / 2.0;
     257  else
     258    v = (this->nextKeyFrame->position - this->currentKeyFrame->position) * (2.0 + sin( M_PI * (- timePassed /this->currentKeyFrame->duration)) )/ 2.0;
     259 
     260  this->object->shiftCoor(v - this->currentKeyFrame->lastPosition);
     261  this->currentKeyFrame->lastPosition = v;
    250262}
    251263
Note: See TracChangeset for help on using the changeset viewer.