Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 3, 2006, 6:05:34 PM (19 years ago)
Author:
bottac
Message:
 
Location:
branches/single_player_map/src/lib/collision_reaction
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/lib/collision_reaction/cr_defs.h

    r8894 r9058  
    2929
    3030//!< the collision axis x collision event
    31 #define COLLISION_TYPE_AXIS_X   1
     31#define COLLISION_TYPE_AXIS_X      1
     32#define COLLISION_TZPE_AXIS_X_NEG  2
    3233//!< the collision axis y collision event
    33 #define COLLISION_TYPE_AXIS_Y   2
     34#define COLLISION_TYPE_AXIS_Y      3
     35#define COLLISION_TYPE_AXIS_Y_NEG  4
    3436//!< the collision axis z collision event
    35 #define COLLISION_TYPE_AXIS_Z   4
     37#define COLLISION_TYPE_AXIS_Z      5
     38#define COLLISION_TYPE_AXIS_Z_NEG  6
    3639//!< the collision is a obb collision
    3740#define COLLISION_TYPE_OBB      8
  • branches/single_player_map/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9057 r9058  
    112112        }
    113113        break;
     114       
     115      case COLLISION_TYPE_AXIS_X_NEG:
     116        front = collPos.len() - box->halfLength[0]; // should be [0]
     117
     118        // object is beneath the plane (ground)
     119        if( front <= 0.0f )
     120        {
     121          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     122          Vector backoff = dirX * front * -1.0f;
     123         
     124          entity->setAbsCoor(entity->getLastAbsCoor());
     125         // entity->shiftCoor(backoff);
     126        }
     127        // object is already in the wall
     128        else if( ce->isInWall())
     129        {
     130          entity->setAbsCoor(entity->getLastAbsCoor());
     131        }
     132        break;
    114133
    115134
    116135        // collision in the y-axis
    117       case COLLISION_TYPE_AXIS_Y:
     136      case COLLISION_TYPE_AXIS_Y_NEG:
    118137        // calulate the height above ground
    119138        height = collPos.y - box->halfLength[1];
     
    149168        {
    150169          entity->setAbsCoor(entity->getAbsCoor());
    151           //Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
    152           //Vector backoff = dirZ * side;
    153           //entity->shiftCoor(backoff);
     170          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
     171          Vector backoff = dirZ * side;
     172          entity->shiftCoor(backoff);
     173        }
     174        // object is already in the wall
     175        else if( ce->isInWall())
     176        {
     177          entity->setAbsCoor(entity->getLastAbsCoor());
     178        }
     179        break;
     180       
     181       
     182         // collision in the z-axis
     183      case COLLISION_TYPE_AXIS_Z_NEG:
     184
     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         
     191          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
     192          Vector backoff = dirZ * side*-1.0f;
     193          entity->shiftCoor(backoff);
    154194        }
    155195        // object is already in the wall
Note: See TracChangeset for help on using the changeset viewer.