Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9058 in orxonox.OLD


Ignore:
Timestamp:
Jul 3, 2006, 6:05:34 PM (18 years ago)
Author:
bottac
Message:
 
Location:
branches/single_player_map/src/lib
Files:
3 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
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r9056 r9058  
    972972  Vector position1 = position;
    973973  Vector position2 = position + Vector(0.0,1.0,0.0);
     974  Vector position3 = position;
     975  Vector position4 = position + Vector(0.0,1.0,0.0);
    974976  Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //
    975977  Vector dest1 = position + forwardDir*4.0f;
    976978  Vector dest2 = position2 + forwardDir*4.0;
     979  Vector dest3 = position + forwardDir*4.0f;
     980  Vector dest4 = position2 + forwardDir*4.0;
    977981  dest = position - Vector(0.0, 40.0,0.0);
    978982  Vector out = dest;
     
    986990
    987991  if( box != NULL) {
    988     position = worldEntity->getAbsCoor() +  box->center + Vector(0.0, 1.0, 0.0) * box->halfLength[1] * 1.0f;
     992    position = worldEntity->getAbsCoor() +  box->center; // + Vector(0.0, 1.0, 0.0) * box->halfLength[1] * 1.0f;
    989993    dest     = worldEntity->getAbsCoor() +  box->center - Vector(0.0, 1.0, 0.0) * (box->halfLength[1] + BSP_Y_OFFSET) *   100;
    990994
    991995    Vector dirX =  worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
    992996
    993     position1 = worldEntity->getAbsCoor() +  box->center - dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     997    //position1 = worldEntity->getAbsCoor() +  box->center - dirX * (box->halfLength[0]  + BSP_X_OFFSET);
    994998    dest1     = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
    995 
     999    dest2     = worldEntity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     1000   
    9961001    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);
    999 
     1002    //position2 = worldEntity->getAbsCoor() +  box->center - dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
     1003    dest3     = worldEntity->getAbsCoor() +  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
     1004    dest4     = worldEntity->getAbsCoor() -  box->center + dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
    10001005  } else {
    10011006    // Init positions and destinations to anything useful!
     
    10551060  bool xCollision = false;
    10561061  bool zCollision = false;
     1062  bool xCollisionNeg = false;
     1063  bool zCollisionNeg = false;
     1064 
    10571065
    10581066
     
    11231131  // Return the normal here: Normal's stored in this->collPlane;
    11241132  if( collision) {
    1125     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1133    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    11261134}
    11271135  if(xCollision) {
    11281136    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
    11291137  }
     1138 
    11301139  if(zCollision) {
    11311140    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
Note: See TracChangeset for help on using the changeset viewer.