Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8963 in orxonox.OLD


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

direction change soft now

File:
1 edited

Legend:

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

    r8961 r8963  
    176176  if (!this->behaviourList.empty())
    177177  {
     178    GenericNPC::Anim currentAnimation = this->behaviourList.front();
     179
    178180    switch(this->behaviourList.front().type)
    179181    {
    180182      case Walk:
     183      {
    181184        if( this->getAnimation() != RUN)
    182185          this->setAnimation(RUN, MD2_ANIM_LOOP);
     186
     187        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     188        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     189      }
    183190        break;
    184191      case Run:
     
    216223    return;
    217224
     225
    218226  if (!this->behaviourList.empty())
    219227  {
    220     switch(this->behaviourList.front().type)
     228    GenericNPC::Anim currentAnimation = this->behaviourList.front();
     229
     230    switch( currentAnimation.type)
    221231    {
    222232      case Walk:
     233      {
    223234        if( this->getAnimation() != RUN)
    224235          this->setAnimation(RUN, MD2_ANIM_LOOP);
     236
     237        Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     238        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     239      }
    225240        break;
    226241      case Run:
     
    402417  {
    403418    GenericNPC::Anim currentAnimation = this->behaviourList.front();
     419
    404420    switch( currentAnimation.type)
    405421    {
     
    412428          {
    413429            this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt);
    414             this->setAbsDir(Quaternion(dest.getNormalized(), Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     430
    415431          }
    416432        }
Note: See TracChangeset for help on using the changeset viewer.