Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Apr 26, 2005, 3:54:02 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: now implemented the shiftCoor functions correctly

File:
1 edited

Legend:

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

    r3984 r3985  
    178178    case ANIM_LINEAR:
    179179      this->animFuncMov = &Animation3D::mLinear;
    180       this->object->setRelCoor(this->currentKeyFrame->position);
     180      //this->object->setRelCoor(this->currentKeyFrame->position);
    181181      this->currentKeyFrame->lastPosition = Vector();
    182182      break;
    183183    case ANIM_SINE:
    184184      this->animFuncMov = &Animation3D::mSine;
    185       this->object->setRelCoor(this->currentKeyFrame->position);
     185      //this->object->setRelCoor(this->currentKeyFrame->position);
    186186      this->currentKeyFrame->lastPosition = Vector();
    187187      break;
    188188    case ANIM_COSINE:
    189189      this->animFuncMov = &Animation3D::mCosine;
     190      //this->object->setRelCoor(this->currentKeyFrame->position);
     191      this->currentKeyFrame->lastPosition = Vector();
    190192      break;
    191193    case ANIM_EXP:
     
    244246void Animation3D::mSine(float timePassed) const
    245247{
    246   /*
    247   if( timePassed  < this->currentKeyFrame->duration/2.0)
    248     this->object->setRelCoor( this->currentKeyFrame->position + (this->nextKeyFrame->position - this->currentKeyFrame->position) *
    249                               sin( M_PI * timePassed /this->currentKeyFrame->duration) / 2.0);
    250   else
    251     this->object->setRelCoor( this->nextKeyFrame->position - (this->nextKeyFrame->position - this->currentKeyFrame->position) *
    252                               sin( M_PI * (1.0 - timePassed /this->currentKeyFrame->duration) )/2.0);
    253   */
    254248  Vector v;
    255249  if( timePassed  < this->currentKeyFrame->duration/2.0)
     
    271265void Animation3D::mCosine(float timePassed) const
    272266{
     267  Vector v;
     268  v = (this->nextKeyFrame->position - this->currentKeyFrame->position) * (1.0 + cos( M_PI * timePassed / this->currentKeyFrame->duration))/2.0;
     269  this->object->shiftCoor(v - this->currentKeyFrame->lastPosition);
     270  this->currentKeyFrame->lastPosition = v;
     271
     272
     273  /*
    273274  this->object->setRelCoor( this->nextKeyFrame->position -
    274275                            (this->nextKeyFrame->position - this->currentKeyFrame->position) *
    275276                            (1.0 + cos( M_PI * timePassed / this->currentKeyFrame->duration))/2.0);
     277  */
    276278}
    277279
Note: See TracChangeset for help on using the changeset viewer.