Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9050 in orxonox.OLD for branches/single_player_map


Ignore:
Timestamp:
Jul 3, 2006, 5:08:54 PM (18 years ago)
Author:
bottac
Message:

cr_ground_walk fixed

Location:
branches/single_player_map/src/lib
Files:
3 edited

Legend:

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

    r9003 r9050  
    9595        // collision in the x-axis
    9696      case COLLISION_TYPE_AXIS_X:
    97         front = collPos.x - box->halfLength[0]; // should be [0]
     97        front = collPos.len() - box->halfLength[0]; // should be [0]
    9898
    9999        // object is beneath the plane (ground)
    100100        if( front <= 0.0f )
    101101        {
    102           Vector backoff = entity->getAbsDirX() * front;
    103 //           entity->shiftCoor(backoff);
     102          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     103          Vector backoff = dirX * front;
     104          entity->shiftCoor(backoff);
    104105        }
    105106        // object is already in the wall
     
    118119
    119120        // object is beneath the plane (ground)
    120         if( height <= 0.0f )
    121         {
    122           entity->shiftCoor(Vector(0.0f, -height, 0.0f));
     121        if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
     122        else if( height < 0.0f )
     123        {
     124          entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
    123125          entity->setOnGround(true);
    124126        }
     
    139141      case COLLISION_TYPE_AXIS_Z:
    140142
    141         side = collPos.z - box->halfLength[2]; // should be [2]
     143        side = collPos.len() - box->halfLength[2]; // should be [2]
    142144
    143145        // object is beneath the plane (ground)
    144146        if( side <= 0.0f )
    145147        {
    146           Vector backoff = entity->getAbsDirX() * side;
    147 //           entity->shiftCoor(backoff);
     148       
     149          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
     150          Vector backoff = dirZ * side;
     151//          entity->shiftCoor(backoff);
    148152        }
    149153        // object is already in the wall
     
    155159    }
    156160  }
    157   //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
     161  PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
    158162
    159163
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r9003 r9050  
    986986
    987987  if( box != NULL) {
    988     position = worldEntity->getAbsCoor() +  box->center + Vector(0.0, 1.0, 0.0) * box->halfLength[1];
    989     dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET);
    990 
    991     position1 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
    992     dest1     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirX() * (box->halfLength[0]  + BSP_X_OFFSET);
    993 
    994     position2 = worldEntity->getAbsCoor() +  box->center - worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
    995     dest2     = worldEntity->getAbsCoor() +  box->center + worldEntity->getAbsDirZ() * (box->halfLength[2]  + BSP_Z_OFFSET);
     988    position = worldEntity->getAbsCoor() +  box->center + Vector(0.0, 1.0, 0.0) * box->halfLength[1] * 0.001;
     989    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET) *   100;
     990
     991    Vector dirX =  worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     992    dirX.debug();
     993    position1 = worldEntity->getAbsCoor() +  box->center - dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     994    dest1     = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     995
     996    Vector dirZ =  worldEntity->getAbsDirZ(); dirX.y = 0.0f; dirZ.normalize();
     997    position2 = worldEntity->getAbsCoor() +  box->center - dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
     998    dest2     = worldEntity->getAbsCoor() +  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
    996999
    9971000  } else {
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.h

    r9003 r9050  
    2828
    2929
    30 #define BSP_X_OFFSET 20.0f
     30#define BSP_X_OFFSET 40.0f
    3131#define BSP_Y_OFFSET 40.0f
    3232#define BSP_Z_OFFSET 20.0f
Note: See TracChangeset for help on using the changeset viewer.