Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8967 in orxonox.OLD


Ignore:
Timestamp:
Jun 30, 2006, 4:28:40 PM (18 years ago)
Author:
patrick
Message:

now rotating around bad axis, collision detection with ground but no moving yet

Location:
branches/single_player_map/src/world_entities/npcs
Files:
2 edited

Legend:

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

    r8966 r8967  
    196196          this->setAnimation(RUN, MD2_ANIM_LOOP);
    197197
    198         Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     198        Vector dir = (currentAnimation.v - this->getAbsCoor());
     199        dir.y = 0.0f;
     200        dir.getNormalized();
    199201        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
    200202
     
    262264          this->setAnimation(RUN, MD2_ANIM_LOOP);
    263265
    264         Vector dir = (currentAnimation.v - this->getAbsCoor()).getNormalized();
     266        Vector dir = (currentAnimation.v - this->getAbsCoor());
     267        dir.y = 0.0f;
     268        dir.getNormalized();
    265269        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
    266270
     
    472476          else
    473477          {
     478            dest.y = 0.0f;
    474479            this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt);
    475480
     
    486491        {
    487492          this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt);
    488           this->setAbsDir(Quaternion(dest.getNormalized(), Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
    489493        }
    490494      }
     
    499503        {
    500504          this->shiftCoor(dest.getNormalized() * currentAnimation.speed * dt);
    501           this->setAbsDir(Quaternion(dest.getNormalized(), Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
    502505        }
    503506      }
     
    519522    }
    520523  }
     524
     525  // physical falling of the player
     526  if( !this->isOnGround())
     527  {
     528    this->fallVelocity += 300.0f * dt;
     529    velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
     530    PRINTF(0)("%s is not on ground\n", this->getName());
     531  }
     532  else
     533  {
     534    this->fallVelocity = 0.0f;
     535  }
     536
     537  this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
    521538
    522539}
  • branches/single_player_map/src/world_entities/npcs/generic_npc.h

    r8966 r8967  
    129129   Animation3D*                            currentAnim;
    130130   float                                   time;          //!< Duration of the action
     131   float                                   fallVelocity;
    131132};
    132133
Note: See TracChangeset for help on using the changeset viewer.