Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8924 in orxonox.OLD for branches/single_player_map/src/lib


Ignore:
Timestamp:
Jun 29, 2006, 10:47:05 PM (18 years ago)
Author:
patrick
Message:

collision reaction refine

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

    r8923 r8924  
    7474
    7575  float height;
    76 
    77 
    78    const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
    79    std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
    80    for(; it != collisionEvents->end(); it++)
    81    {
    82 
    83      CollisionEvent* ce = (*it);
    84      Vector normal = ce->getGroundNormal();
    85 
    86      // collision position maths
    87      Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
    88 
    89 
    90      // test the 3 axis differently
    91      switch( ce->getType())
    92      {
    93        // collision in the x-axis
    94        case COLLISION_TYPE_AXIS_X:
    95          PRINTF(0)("AXIS X\n");
    96          break;
    97 
    98 
    99        // collision in the y-axis
    100        case COLLISION_TYPE_AXIS_Y:
    101          // calulate the height above ground
    102          height = collPos.y - box->halfLength[1];
    103 
    104          PRINTF(0)("height: %f\n", height);
    105          PRINTF(0)("in wall %i\n", ce->isInWall());
    106 
    107          // object is beneath the plane (ground)
    108          if( height <= 0.0f )
    109          {
    110            entity->shiftCoor(Vector(0, -height, 0));
    111          }
    112          // object is already in the wall
    113          else if( ce->isInWall())
    114          {
    115            entity->setAbsCoor(entity->getLastAbsCoor());
    116          }
    117          break;
    118 
    119 
    120        // collision in the z-axis
    121        case COLLISION_TYPE_AXIS_Z:
    122          PRINTF(0)("AXIS Y\n");
    123          break;
    124      }
    125    }
     76  float front;
     77
     78
     79  const std::vector<CollisionEvent*>* collisionEvents = &(collision->getCollisionEvents());
     80  std::vector<CollisionEvent*>::const_iterator it = collisionEvents->begin();
     81  for(; it != collisionEvents->end(); it++)
     82  {
     83
     84    CollisionEvent* ce = (*it);
     85    Vector normal = ce->getGroundNormal();
     86
     87    // collision position maths
     88    Vector collPos =  collision->getEntityB()->getAbsCoor()  + box->center - ce->getCollisionPosition();
     89
     90
     91    // test the 3 axis differently
     92    switch( ce->getType())
     93    {
     94        // collision in the x-axis
     95      case COLLISION_TYPE_AXIS_X:
     96        front = collPos.x - box->halfLength[0];
     97
     98        PRINTF(0)("front: %f\n", front);
     99        PRINTF(0)("in wall %i\n", ce->isInWall());
     100
     101        // object is beneath the plane (ground)
     102        if( front <= 0.0f )
     103        {
     104//           entity->shiftCoor(Vector(front, 0.0f, 0.0f));
     105        }
     106        // object is already in the wall
     107        else if( ce->isInWall())
     108        {
     109//           entity->setAbsCoor(entity->getLastAbsCoor());
     110        }
     111        break;
     112
     113
     114        // collision in the y-axis
     115      case COLLISION_TYPE_AXIS_Y:
     116        // calulate the height above ground
     117        height = collPos.y - box->halfLength[1];
     118
     119
     120        // object is beneath the plane (ground)
     121        if( height <= 0.0f )
     122        {
     123          entity->shiftCoor(Vector(0.0f, -height, 0.0f));
     124        }
     125        // object is already in the wall
     126        else if( ce->isInWall())
     127        {
     128          entity->setAbsCoor(entity->getLastAbsCoor());
     129        }
     130        break;
     131
     132
     133        // collision in the z-axis
     134      case COLLISION_TYPE_AXIS_Z:
     135        break;
     136    }
     137  }
    126138
    127139
     
    212224 */
    213225void CRPhysicsGroundWalk::update(WorldEntity* owner)
    214 {
    215 }
    216 
    217 
     226{}
     227
     228
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r8922 r8924  
    987987  if( box != NULL) {
    988988    position = worldEntity->getAbsCoor() +  box->center + box->axis[1] * box->halfLength[1];
    989     dest     = worldEntity->getAbsCoor() +  box->center - box->axis[1] * box->halfLength[1] * 40.0;
     989    dest     = worldEntity->getAbsCoor() +  box->center - box->axis[1] * box->halfLength[1]  * 40.0f;
    990990
    991991    position1 = worldEntity->getAbsCoor() +  box->center + box->axis[0] * box->halfLength[0] * 2.0f;
    992     dest1     = worldEntity->getAbsCoor() +  box->center - box->axis[0] * box->halfLength[0] *2.0f;
     992    dest1     = worldEntity->getAbsCoor() +  box->center - box->axis[0] * box->halfLength[0] * 2.0f;
    993993
    994994
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.h

    r8910 r8924  
    2828
    2929
     30#define BSP_X_OFFSET 10.0f
     31#define BSP_Y_OFFSET 40.0f
     32#define BSP_Z_OFFSET 10.0f
     33
    3034
    3135// FORWARD DECLARATIONS
     
    5660
    5761  BspManager(const char* fileName, float scale = 0.4f);
    58  
     62
    5963  // Deconstructor
    6064  ~BspManager();
    61  
    62  
     65
     66
    6367
    6468  // Functions
     
    106110  Vector inputStart;
    107111  Vector inputEnd;
    108  
     112
    109113  Vector traceMins; //!< Mins of current bbox
    110114  Vector traceMaxs; //!< Maxs of current bbox
     
    122126  Vector out1; //!< For debugging only
    123127  Vector out2; //!< For debugging only
    124                        
     128
    125129  int tgl;
    126130};
Note: See TracChangeset for help on using the changeset viewer.