Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3732 in orxonox.OLD for orxonox/trunk/src/simple_animation.cc


Ignore:
Timestamp:
Apr 6, 2005, 10:48:58 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: SimpleAnimation - now sinusoidal velocity distribution works also.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/simple_animation.cc

    r3731 r3732  
    263263      this->localTime -= this->currentFrame->time;
    264264
    265       this->currentFrame->object->setRelCoor(this->currentFrame->position);
     265      this->currentFrame->object->setRelCoor(*this->currentFrame->position);
    266266      *this->lastPosition = *this->currentFrame->position;
    267267
    268268      this->lastFrame = this->currentFrame;
    269269      this->currentFrame = this->frames->nextElement(this->currentFrame);
     270      this->mode = this->currentFrame->mode;
    270271    }
    271272
     
    275276    case LINEAR:
    276277
    277       *this->tmpVect = *this->lastFrame->position - *this->currentFrame->position;
     278      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    278279      *this->tmpVect = *this->tmpVect * this->localTime / this->currentFrame->time;
    279       //this->currentFrame->object->shiftCoor(*this->tmpVect - *this->lastPosition);
    280       this->currentFrame->object->setRelCoor(*this->currentFrame->position + *this->tmpVect);
     280      this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
    281281      *this->lastPosition = *this->tmpVect;
    282       //printf("shift vector: ");this->lastPosition->debug();
    283282      break;
    284283    case EXP:
     
    288287      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    289288      *this->tmpVect = *this->tmpVect * (1 - exp(- this->localTime / this->currentFrame->time));     
     289      this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
     290      *this->lastPosition = *this->tmpVect;
    290291      break;
    291292    case SIN:
    292293      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    293       *this->tmpVect = *this->tmpVect * (1 - cos(- this->localTime / this->currentFrame->time));     
     294      *this->tmpVect = *this->tmpVect * 0.5*(1 - cos(M_PI * this->localTime / this->currentFrame->time));     
     295      this->currentFrame->object->setRelCoor(*this->lastFrame->position + *this->tmpVect);
     296      *this->lastPosition = *this->tmpVect;
    294297      break;
    295298    case COS:
Note: See TracChangeset for help on using the changeset viewer.