Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8964 in orxonox.OLD


Ignore:
Timestamp:
Jun 30, 2006, 3:43:48 PM (18 years ago)
Author:
patrick
Message:

crouch and run work also

File:
1 edited

Legend:

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

    r8963 r8964  
    190190        break;
    191191      case Run:
     192      {
    192193        if( this->getAnimation() != RUN)
    193194          this->setAnimation(RUN, MD2_ANIM_LOOP);
     195
     196        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     197        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     198      }
    194199        break;
    195200      case Crouch:
     201      {
    196202        if( this->getAnimation() != CROUCH_WALK)
    197203          this->setAnimation(CROUCH_WALK, MD2_ANIM_LOOP);
     204
     205        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     206        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     207      }
    198208        break;
    199209      case LookAt:
     
    240250        break;
    241251      case Run:
     252      {
    242253        if( this->getAnimation() != RUN)
    243254          this->setAnimation(RUN, MD2_ANIM_LOOP);
     255
     256        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     257        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     258      }
    244259        break;
    245260      case Crouch:
     261      {
    246262        if( this->getAnimation() != CROUCH_WALK)
    247263          this->setAnimation(CROUCH_WALK, MD2_ANIM_LOOP);
     264
     265        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     266        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     267      }
    248268        break;
    249269      case LookAt:
     270      {
    250271        if( this->getAnimation() != STAND)
    251272          this->setAnimation(STAND, MD2_ANIM_LOOP);
     273      }
    252274        break;
    253275      case Shoot:
Note: See TracChangeset for help on using the changeset viewer.