Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3986 in orxonox.OLD


Ignore:
Timestamp:
Apr 26, 2005, 12:38:20 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: fixed two major bugs in the animation3d framework (addKeyFrame, tick issues), added shoot animation again. one of both animation is still placed at the wrong place, since the weapons are not symmetrical

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r3984 r3986  
    478478
    479479
    480             animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_SINE, ANIM_LINEAR);
    481             animation->addKeyFrame(Vector(0, 2, 0), Quaternion(M_PI, Vector(0,1,0)), 1.0, ANIM_SINE, ANIM_LINEAR);
    482             animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_SINE, ANIM_SINE);
     480            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
     481            animation->addKeyFrame(Vector(0, 2, 0), Quaternion(M_PI, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
     482            animation->addKeyFrame(Vector(0, 0, 0), Quaternion(0, Vector(0,1,0)), 1.0, ANIM_NEG_EXP, ANIM_LINEAR);
    483483
    484484
  • orxonox/trunk/src/util/animation/animation3d.cc

    r3985 r3986  
    4646  this->animFuncMov = &Animation3D::mLinear;
    4747  this->animFuncRot = &Animation3D::rLinear;
     48
     49  this->bRunning = false;
    4850}
    4951
     
    172174  switch (animFuncMov)
    173175    {
    174     default:
    175176    case ANIM_CONSTANT:
    176177      this->animFuncMov = &Animation3D::mConstant;
     
    197198      this->animFuncMov = &Animation3D::mNegExp;
    198199      this->expFactorMov = -1.0 / this->currentKeyFrame->duration * logf(DELTA_X_3D);
     200      this->currentKeyFrame->lastPosition = Vector();
    199201      break;
    200202    case ANIM_QUADRATIC:
     
    204206      this->animFuncMov = &Animation3D::mRandom;
    205207      break;
     208    default:
     209      break;
    206210    }
    207211}
     
    215219void Animation3D::mConstant(float timePassed) const
    216220{
    217   this->object->setRelCoor(this->currentKeyFrame->position);
     221  //this->object->setRelCoor(this->currentKeyFrame->position);
    218222
    219223  /*
     
    296300void Animation3D::mNegExp(float timePassed) const
    297301{
     302  Vector v;
     303  v = (this->nextKeyFrame->position - this->currentKeyFrame->position) * (1.0 - expf(- timePassed * expFactorMov));
     304  this->object->shiftCoor(v - this->currentKeyFrame->lastPosition);
     305  this->currentKeyFrame->lastPosition = v;
     306
     307  /*
    298308  this->object->setRelCoor( this->currentKeyFrame->position +
    299309                            (this->nextKeyFrame->position - this->currentKeyFrame->position) *
    300310                            (1.0 - expf(- timePassed * expFactorMov)) );
     311  */
    301312}
    302313
     
    320331void Animation3D::mRandom(float timePassed) const
    321332{
     333  /*
    322334  this->object->setRelCoor(this->currentKeyFrame->position +
    323335                           (this->nextKeyFrame->position - this->currentKeyFrame->position) * (float)rand()/(float)RAND_MAX);
    324336  this->object->setRelDir(this->currentKeyFrame->direction +
    325337                          (this->nextKeyFrame->direction - this->currentKeyFrame->direction)* (float)rand()/(float)RAND_MAX);
     338  */
    326339}
    327340
     
    338351  switch (animFuncRot)
    339352    {
    340    default:
     353    default:
    341354    case ANIM_CONSTANT:
    342355      this->animFuncRot = &Animation3D::rConstant;
     356      printf("a;sdlfkja;lskdjf;alskjdf;lasjdf;lasjdf;lasjdf;lajsdf\n");
    343357      break;
    344358    case ANIM_LINEAR:
     
    364378      this->animFuncRot = &Animation3D::rRandom;
    365379      break;
     380
    366381    }
    367382}
  • orxonox/trunk/src/world_entities/environment.cc

    r3964 r3986  
    5050void Environment::draw ()
    5151{
    52   //this->getRelCoor()->debug();
     52  //this->getRelCoor().debug();
    5353
    5454  glMatrixMode(GL_MODELVIEW);
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3980 r3986  
    5050  this->animation1 = new Animation3D(this->objectComponent1);
    5151  //this->animation2 = new Animation3D(this);
    52   parent->addChild(this->objectComponent1, PNODE_ALL);
     52  //parent->addChild(this->objectComponent1, PNODE_ALL);
     53  this->addChild(this->objectComponent1, PNODE_ALL);
    5354
    5455  this->animation1->setInfinity(ANIM_INF_CONSTANT);
     
    5859      this->projectileOffset = Vector(1.0, 0.0, -0.35);
    5960
    60       this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
    61       this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
    62       this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
    63 
    64       //this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
    65       //this->animation2->addKeyFrame(Vector(-2.6, 0.1, 1.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
     61      //this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
     62      //this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
     63      //this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
     64
     65      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     66      this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     67      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
     68
     69
     70      //this->animation2->addKeyFrame(Vector(0, 0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
     71      //this->animation2->addKeyFrame(Vector(0, 0, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
     72      //this->animation2->addKeyFrame(Vector(0, 0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
    6673    }
    6774  else if( this->leftRight == W_RIGHT)
     
    6976      this->projectileOffset = Vector(1.0, 0.0, 0.5);
    7077
    71       this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_NEG_EXP);
    72       this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_NEG_EXP);
    73       this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_NEG_EXP);
     78      //this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
     79      //this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);
     80      //this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
     81
     82      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     83      this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     84      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
     85
     86
     87      //this->animation2->addKeyFrame(Vector(0, 0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
     88      //this->animation2->addKeyFrame(Vector(0, 0, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
     89      //this->animation2->addKeyFrame(Vector(0, 0, 0.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_LINEAR);
    7490    }
     91
    7592}
    7693
     
    95112{
    96113  printf("ACTIVATE \n");
    97   this->animation2->replay();
     114  //this->animation2->replay();
    98115}
    99116
     
    180197void TestGun::draw ()
    181198{
     199  //this->getRelCoor().debug();
     200  //this->getAbsCoor().debug();
     201
     202  this->objectComponent1->getRelCoor().debug();
     203  //this->objectComponent1->getAbsCoor().debug();
     204
    182205  /* draw gun body */
    183206  glMatrixMode(GL_MODELVIEW);
Note: See TracChangeset for help on using the changeset viewer.