Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 16, 2006, 11:40:03 AM (18 years ago)
Author:
bottac
Message:

Worked on ground walk.

Location:
branches/bsp_model/src/lib/collision_reaction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r8490 r8524  
    2323#include "world_entity.h"
    2424#include "cr_physics_ground_walk.h"
    25 
    26 #include "debug.h"
    2725
    2826#include <vector>
     
    5755  CollisionEvent* ce = collision->getCollisionEvents().front();
    5856  Vector normal = ce->getGroundNormal();
    59   normal.normalize();
     57  // normal.normalize();
    6058
    6159  // put it back
     
    6462//   PRINTF(0)("current pos:\n");
    6563//   collision->getEntityB()->getAbsCoor().debug();
     64 
     65 
     66  Vector height = ce->getCollisionPosition() - collision->getEntityB()->getAbsCoor();
     67  if(ce->getGroundNormal().len() <= 0.1f)
     68  {
     69    collision->getEntityB()->setAbsCoor(collision->getEntityB()->getLastAbsCoor());
     70    return;
     71  }
     72  if(height.y < -3.6)
     73  {
     74    downspeed++;
     75    collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,-0.03*downspeed,0.0));
     76   
     77  }
     78  else
     79  {
     80    if(height.y > -3.5  && height.y <    3.9)
     81    {
     82      //if(downspeed <= 0) downspeed =1;
     83      collision->getEntityB()->setAbsCoor(collision->getEntityB()->getAbsCoor() + Vector(0.0,height.y+3.55,0.0));   
     84      //collision->getEntityB()->setVelocity(Vector(0.0,0.0,0.0));   
     85    }
     86      downspeed = 0;
     87  }
     88 
    6689
     90  /*
    6791  PRINTF(0)("Collision with Ground: \n");
    6892  collision->getEntityB()->getAbsCoor().debug();
     93  collision->getEntityB()->setVelocity(Vector());
     94  collision->getEntityB()->setAbsCoor(this->lastPositions[1]);
     95 
     96  */
     97}
    6998
    70   //collision->getEntityB()->setVelocity(Vector());
    71   //collision->getEntityB()->setAbsCoor(this->lastPositions[5]);
    72 }
    7399
    74100
  • branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.h

    r8490 r8524  
    2929
    3030    Vector       lastPositions[10];           //!< last 10 positions
     31    float        downspeed;
    3132};
    3233
Note: See TracChangeset for help on using the changeset viewer.