Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 27, 2006, 3:29:10 PM (19 years ago)
Author:
snellen
Message:

continued working on turning:turning doesn't quite work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/npcs/generic_npc.cc

    r8825 r8829  
    4343                        addMethod("walkTo", ExecutorLua3ret<GenericNPC,float,float,float,float>(&GenericNPC::walkTo))
    4444                        ->addMethod("setTime", ExecutorLua1<GenericNPC,float>(&GenericNPC::setTime))
     45                        ->addMethod("turnTo", ExecutorLua4ret<GenericNPC,bool,float,float,float,float>(&GenericNPC::turnTo))
    4546                       );
    4647
     
    155156    this->destDir = destDir;
    156157
    157     float time = 100.0f;
     158    //float time = 100.0f;
    158159
    159160    if( this->currentAnim != NULL)
     
    161162
    162163    this->currentAnim = new Animation3D(this);
     164    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
    163165    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
    164166    this->currentAnim->addKeyFrame(this->destCoor, this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
    165 
    166167
    167168    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
     
    407408  Quaternion destDir = Quaternion(Vector(qx, qy, qz), qu);
    408409
     410  printf("Turning: %f, %f, %f, %f \n",qu,qx,qy,qz);
    409411  // check if this is the current goal
     412  this->destDir.debug();
     413  destDir.debug();
    410414  if( this->destDir != destDir)
    411415  {
    412     this->destCoor = destCoor;
    413 
    414     float time = 5.0f;
    415 
     416//     if( this->currentAnim != NULL)
     417//       this->currentAnim->stop();
     418//     
     419    PRINTF(0)("SET ANIMATION\n");
     420    this->destDir = destDir;
     421//
     422   
     423   
    416424    if( this->currentAnim != NULL)
    417425      delete this->currentAnim;
    418 
     426   
     427    this->setAbsDirSoft(destDir, 0.1f);
     428/*
    419429    this->currentAnim = new Animation3D(this);
     430    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), 0.0f, ANIM_LINEAR, ANIM_LINEAR);
    420431    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->getAbsDir(), time, ANIM_LINEAR, ANIM_LINEAR);
    421432    this->currentAnim->addKeyFrame(this->getAbsCoor(), this->destDir, time, ANIM_LINEAR, ANIM_LINEAR);
    422433
     434
    423435    this->currentAnim->setInfinity(ANIM_INF_CONSTANT);
    424     this->currentAnim->play();
    425 
     436    this->currentAnim->play();*/
     437   
    426438    this->setAnimation(STAND, MD2_ANIM_LOOP);
    427439  }
     
    468480    ((InteractiveModel*)this->getModel(0))->tick(time);
    469481
    470   // tick this animation
    471   if( this->currentAnim != NULL)
    472     this->currentAnim->tick(time);
    473482}
    474483
Note: See TracChangeset for help on using the changeset viewer.