Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9099 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 4, 2006, 3:51:10 AM (18 years ago)
Author:
patrick
Message:

cr better and better

File:
1 edited

Legend:

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

    r9096 r9099  
    7070
    7171
    72   float CR_MAX_WALK_HEIGHT = 10.0f;
     72  float CR_MAX_WALK_HEIGHT = 15.0f;
    7373  float CR_THRESHOLD = 0.2f;
    7474
    75   float height = 0;
    76   float front = 0;
    77   float side = 0;
     75  float height = 0.0f;
     76  float front = 0.0f;
     77  float back = 0.0f;
     78  float right = 0.0f;
     79  float left = 0.0f;
    7880
    7981
     
    9294    switch( ce->getType())
    9395    {
    94         // collision in the x-axis
     96      /* collision in the X-AXIS */
    9597      case COLLISION_TYPE_AXIS_X:
    96         front = collPos.len() - box->halfLength[0]; // should be [0]
     98        front = collPos.len() - box->halfLength[0];
    9799
    98100        // object is beneath the plane (ground)
     
    113115
    114116      case COLLISION_TYPE_AXIS_X_NEG:
    115         front = collPos.len() - box->halfLength[0]; // should be [0]
    116 
    117         // object is beneath the plane (ground)
    118         if( front <= 0.0f)
     117        back = collPos.len() - box->halfLength[0];
     118
     119        PRINTF(0)("back: %f\n", back);
     120        // object is beneath the plane (ground)
     121        if( back <= 0.0f)
    119122        {
    120123          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     
    132135
    133136
    134         // collision in the y-axis
     137        /* collision in the Y-AXIS */
    135138      case COLLISION_TYPE_AXIS_Y_NEG:
    136139        // calulate the height above ground
     
    140143        // object is beneath the plane (ground)
    141144//         if(height >= 0.0f && height <= 0.0001f) break ;// Do nothing
    142         if( height < 0.0f /*&& height < -CR_MAX_WALK_HEIGHT*/)
     145        if( height < 0.0f && -height < CR_MAX_WALK_HEIGHT)
    143146        {
    144147          entity->shiftCoor(Vector(0.0f, -height + 0.00001, 0.0f));
     
    162165      case COLLISION_TYPE_AXIS_Z:
    163166
    164         side = collPos.len()  - box->halfLength[2]; // should be [2]
    165 
    166         // object is beneath the plane (ground)
    167         if( side <= 0.0f )
     167        right = collPos.len()  - box->halfLength[2];
     168
     169        // object is beneath the plane (ground)
     170        if( right <= 0.0f )
    168171        {
    169172          entity->setAbsCoor(entity->getAbsCoor());
    170173          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
    171           Vector backoff = dirZ * side;
     174          Vector backoff = dirZ * right;
    172175          entity->shiftCoor(backoff);
    173176        }
     
    183186      case COLLISION_TYPE_AXIS_Z_NEG:
    184187
    185         side = collPos.len()  - box->halfLength[2]; // should be [2]
    186 
    187         // object is beneath the plane (ground)
    188         if( side <= 0.0f )
    189         {
    190 
     188        left = collPos.len()  - box->halfLength[2];
     189
     190        // object is beneath the plane (ground)
     191        if( left <= 0.0f )
     192        {
    191193          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
    192           Vector backoff = dirZ * side*-1.0f;
     194          Vector backoff = dirZ * left*-1.0f;
    193195          entity->shiftCoor(backoff);
    194196        }
Note: See TracChangeset for help on using the changeset viewer.