Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3732 in orxonox.OLD for orxonox


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

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

Location:
orxonox/trunk/src
Files:
2 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:
  • orxonox/trunk/src/story_entities/world.cc

    r3731 r3732  
    472472
    473473            KeyFrame* f1 = new KeyFrame;
    474             f1->position = new Vector(10.0, 1.0, 1.0);
     474            f1->position = new Vector(10.0, 1.0, -1.0);
    475475            f1->direction = new Quaternion();
    476476            f1->time = 1.0;
    477             f1->mode = LINEAR;
     477            f1->mode = SIN;
    478478
    479479
    480480            KeyFrame* f2 = new KeyFrame;
    481             f2->position = new Vector(10.0, 1.0, -1.0);
     481            f2->position = new Vector(10.0, 1.0, 1.0);
    482482            f2->direction = new Quaternion();
    483483            f2->time = 1.0;
    484             f2->mode = LINEAR;
     484            f2->mode = SIN;
    485485
    486486            KeyFrame* f3 = new KeyFrame;
    487             f3->position = new Vector(10.0, 0.0, -1.0);
     487            f3->position = new Vector(5.0, 1.0, -1.0);
    488488            f3->direction = new Quaternion();
    489489            f3->time = 1.0;
    490             f3->mode = LINEAR;
     490            f3->mode = SIN;
    491491
    492492
     
    495495            this->simpleAnimation->addKeyFrame(f1);
    496496            this->simpleAnimation->addKeyFrame(f2);
    497             //this->simpleAnimation->addKeyFrame(f3);
     497            this->simpleAnimation->addKeyFrame(f3);
    498498            //this->simpleAnimation->addKeyFrame(f2);
    499499            this->simpleAnimation->animatorEnd();
Note: See TracChangeset for help on using the changeset viewer.