Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8910 in orxonox.OLD for branches


Ignore:
Timestamp:
Jun 29, 2006, 4:03:42 PM (18 years ago)
Author:
bottac
Message:

Still not working.

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

    r8907 r8910  
    6464
    6565  // put it back
    66   //   PRINTF(0)("putting it back to lastPos: \n");
    67   //   this->lastPositions[0].debug();
    68   //   PRINTF(0)("current pos:\n");
    69   //   collision->getEntityB()->getAbsCoor().debug();
     66     PRINTF(0)("putting it back to lastPos: \n");
     67     //this->lastPositions[0].debug();
     68      PRINTF(0)("current pos:\n");
     69     collision->getEntityB()->getAbsCoor().debug();
     70     
     71   
    7072
    7173  float height;
     
    8688  float CR_THRESHOLD = 0.2f;
    8789
    88 
     90  //height = collPos.y - box->halfLength[1];
     91  //PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
     92  // PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
     93  //
    8994
    9095  switch( ce->getType())
    9196  {
    92     case COLLISION_TYPE_AXIS_Y:
    93 
    94 //       height = collPos.y - box->halfLength[1];
    95 //       PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
    96 //       PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
    97 //
     97   
     98    case COLLISION_TYPE_AXIS_X:
     99      PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
     100      PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
     101      PRINTF(0)("COLLISION_TYPE_AXIS_X \n");
     102      break;
     103   case COLLISION_TYPE_AXIS_Y:
     104
     105      height = collPos.y - box->halfLength[1];
     106      PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
     107       PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
     108       PRINTF(0)("COLLISION_TYPE_AXIS_Y \n");
    98109//       // object is beneath the plane (ground)
    99110//       if( height <= 0.0f )
     
    107118//       }
    108119//       break;
    109 //
    110 
    111     case COLLISION_TYPE_AXIS_X:
     120     break;
     121
     122   
    112123    case COLLISION_TYPE_AXIS_Z:
    113       break;
     124      PRINTF(0)("height: %f          , model height: %f\n", height, box->halfLength[1]);
     125      PRINTF(0)(" ground normal: %f, %f, %f\n", normal.x, normal.y, normal.z);
     126      PRINTF(0)("COLLISION_TYPE_AXIS_Z \n");
     127     break;
    114128
    115129    }
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.cc

    r8907 r8910  
    8282    delete this->bspFile;
    8383}
    84  
     84
    8585int BspManager::load(const char* fileName, float scale)
    8686{
    8787  // open a BSP file
    88  
    89  
     88
     89
    9090  this->bspFile = new BspFile();
    9191  this->bspFile->scale =  scale;
    9292  if(this->bspFile->read(ResourceManager::getFullName(fileName).c_str()) == -1)
    93   return -1;
    94  
     93    return -1;
     94
    9595  this->bspFile->build_tree();
    9696  this->root  = this->bspFile->get_root();
     
    9898
    9999  this->outputFraction = 1.0f;
    100  
     100
    101101  return 0;
    102102}
     
    998998  } else {
    999999    // Init positions and destinations to anything useful!
    1000 
     1000   
    10011001  }
    10021002
     
    10451045  }
    10461046
    1047   plane* testPlane = this->collPlane;
     1047  plane* testPlane = new plane;
     1048  testPlane->x =  this->collPlane->x;
     1049  testPlane->y = this->collPlane->y;
     1050  testPlane->z = this->collPlane->z;
    10481051
    10491052
    10501053  bool xCollision = false;
    10511054  bool zCollision = false;
    1052   if(!SolidFlag) {
     1055 
    10531056
    10541057    // 2nd Collision Detection
     
    10601063    this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
    10611064
    1062     if(!this->outputAllSolid != 1.0f) {
     1065    if(this->outputFraction < 1.0f) {
    10631066      out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction;
    10641067      xCollision = true;
    10651068      testPlane = this->collPlane;
    10661069    }
    1067     if(this->outputAllSolid) {
     1070    if(this->outputAllSolid || !this->outputStartsOut) {
    10681071      SolidFlag = true;
    1069       xCollision = true; 
     1072      xCollision = true;
    10701073    }
    10711074    //out.z = this->outputFraction;
    10721075
    1073     if(!SolidFlag) {
     1076   
    10741077
    10751078      // 3rd Collision Detection
     
    10821085      //out.x = this->outputFraction;
    10831086
    1084       if(this->outputFraction != 1.0f ) {
     1087      if(this->outputFraction < 1.0f ) {
    10851088        out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
    10861089        zCollision = true;
     
    10881091
    10891092      }
    1090       if(this->outputAllSolid) {
    1091           SolidFlag = true;
    1092           zCollision = true;   
     1093      if(this->outputAllSolid || !this->outputStartsOut) {
     1094        SolidFlag = true;
     1095        zCollision = true;
    10931096      }
    1094     }
    1095   }//end if
     1097   
     1098  //end if
    10961099  /*
    10971100  This is how you would calculate the Coordinates where worldEntity Collided with the BSP world.
     
    11041107  if( collision) {
    11051108    PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction);
    1106     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y || (xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0), this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1107   } else {
    1108     if(xCollision || zCollision) {
    1109 
    1110       worldEntity->registerCollision((xCollision ? COLLISION_TYPE_AXIS_X :0) | (zCollision ? COLLISION_TYPE_AXIS_Z :0) , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1111     }
    1112 
    1113   }
     1109    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1110  }
     1111  if(xCollision) {
     1112    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1113  }
     1114  if(zCollision) {
     1115    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1116  }
     1117
     1118
    11141119  //else  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false);
    11151120
  • branches/single_player_map/src/lib/graphics/importer/bsp_manager.h

    r8904 r8910  
    119119  ::std::deque<int> opal; //!< the others here.
    120120
    121   Vector out;  //!< For debugging only
     121  Vector out;  //!< Stores collision coordinates
    122122  Vector out1; //!< For debugging only
    123123  Vector out2; //!< For debugging only
Note: See TracChangeset for help on using the changeset viewer.