Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9037 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 3, 2006, 3:12:46 PM (18 years ago)
Author:
patrick
Message:

some of the npc walk on the ground

File:
1 edited

Legend:

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

    r9036 r9037  
    8888
    8989  // collision reaction registration
    90 //   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
     90  this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
    9191}
    9292
     
    178178 */
    179179void GenericNPC::stop()
    180 {}
     180{
     181
     182}
    181183
    182184
     
    196198
    197199        Vector dir = (currentAnimation.v - this->getAbsCoor());
    198 //         dir.y = 0.0f;
     200        dir.y = this->getAbsCoor().y;
    199201        dir.getNormalized();
    200202        this->setAbsDir(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)));
     
    264266
    265267        Vector dir = (currentAnimation.v - this->getAbsCoor());
    266 //         dir.y = 0.0f;
     268        dir.y = this->getAbsCoor().y;
    267269        dir.getNormalized();
    268270        this->setAbsDirSoft(Quaternion(dir, Vector(0.0, 1.0, 0.0)) * Quaternion(-M_PI_2, Vector(0.0, 1.0, 0.0)), 4.0);
     
    471473        {
    472474          Vector dest = currentAnimation.v - this->getAbsCoor();
     475          dest.y = 0.0f;
     476          PRINTF(0)("%s distance %f\n", this->getName(), dest.len());
    473477          if (dest.len() < .5)
    474478            this->nextStep();
    475479          else
    476480          {
    477 //             dest.y = 0.0f;
     481            //dest.y = 0.0f;
    478482            Vector move = dest.getNormalized() * currentAnimation.speed * dt;
    479483            this->shiftCoor(move);
    480             PRINTF(0)("name %s, move:\n", this->getName());
    481             move.debug();
    482 //             this->shiftCoor(Vector(0.0, 1.0, 1.0));
    483484          }
    484485        }
     
    525526  }
    526527
    527 //   // physical falling of the player
    528 //   if( !this->isOnGround())
    529 //   {
    530 //     this->fallVelocity += 300.0f * dt;
    531 //     velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
    532 //    // PRINTF(0)("%s is not on ground\n", this->getName());
    533 //
    534 //     this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
    535 //
    536 //   }
    537 //   else
    538 //   {
    539 //     this->fallVelocity = 0.0f;
    540 //   }
     528  // physical falling of the player
     529  if( !this->isOnGround())
     530  {
     531    this->fallVelocity += 300.0f * dt;
     532    //velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
     533   // PRINTF(0)("%s is not on ground\n", this->getName());
     534
     535    this->shiftCoor(Vector(0, -this->fallVelocity * dt,0));
     536
     537  }
     538  else
     539  {
     540    this->fallVelocity = 0.0f;
     541  }
    541542
    542543}
Note: See TracChangeset for help on using the changeset viewer.