Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9081 in orxonox.OLD for branches


Ignore:
Timestamp:
Jul 4, 2006, 1:00:22 AM (18 years ago)
Author:
patrick
Message:

cr fix

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/lib/graphics/importer/bsp_manager.cc

    r9080 r9081  
    11431143{
    11441144  // Retrieve Bounding box
    1145   AABB* box = worldEntity->getModelAABB();
     1145  AABB* box = entity->getModelAABB();
    11461146
    11471147
    11481148  Vector forwardDir = Vector(0.0,0.0,1.0);
    11491149  Vector upDir = Vector(0.0,1.0,0.0);
    1150   Vector position = worldEntity->getAbsCoor();
     1150  Vector position = entity->getAbsCoor();
    11511151
    11521152  bool SolidFlag = false;
     
    11561156  Vector position3 = position;
    11571157  Vector position4 = position + Vector(0.0,1.0,0.0);
    1158   Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //
    1159 
    1160   Vector dest3 = position + forwardDir*4.0f;
    1161   Vector dest4 = position2 + forwardDir*4.0;
     1158  Vector dest = entity->getAbsCoor() - upDir*40.0f; //
     1159
     1160  Vector dest3 = position + forwardDir * 4.0f;
     1161  Vector dest4 = position2 + forwardDir * 4.0;
    11621162  dest = position - Vector(0.0, 40.0,0.0);
    11631163  Vector out = dest;
     
    11741174  Vector            right;                      //!< right collision ray
    11751175
     1176  Vector dest1;
     1177
    11761178  float height = 40;
    11771179
    1178   Vector dirX =  worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
     1180  Vector dirX =  entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
    11791181
    11801182  if( box != NULL)
    11811183  {
    1182     left  = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
    1183     right = worldEntity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     1184    left  = entity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
     1185    right = entity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
    11841186  }
    11851187  else
     
    11921194//     dest1
    11931195//     dest2
    1194 
    1195 
    1196 
    1197   // 1st Ray: Y RAY
    1198   this->inputStart =  position;
    1199   this->inputEnd =   dest;
    1200   this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );
    1201 
    1202 
    1203   //
    1204   if(!this->outputStartsOut ) {
    1205     this->collPlane = new plane;
    1206     this->collPlane->x = 0.0f;
    1207     this->collPlane->y = 0.0f;
    1208     this->collPlane->z = 0.0f;
    1209     collision = true;
    1210   } else {
    1211 
    1212     if( this->outputFraction == 1.0f) {
    1213       if(this->outputAllSolid ) {
    1214         this->collPlane = new plane;
    1215         this->collPlane->x = 0.0f;
    1216         this->collPlane->y = 0.0f;
    1217         this->collPlane->z = 0.0f;
    1218         collision = true;
    1219         SolidFlag = true;
    1220       } else
    1221         collision = false;
    1222 
    1223 
    1224         out = dest;
    1225 
    1226     } else {
    1227       collision = true;
    1228       out.x = position.x + (dest.x -position.x) * this->outputFraction;
    1229       out.y = position.y + (dest.y -position.y) * this->outputFraction;
    1230       out.z = position.z + (dest.z -position.z) * this->outputFraction;
    1231 
    1232       Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z);
    1233       this->out = out;
    1234     }
    1235   }
    1236   testPlane = this->collPlane;
    1237 
    1238 
    1239   bool xCollisionNeg = false;
    1240   bool zCollisionNeg = false;
    1241 
    12421196
    12431197
     
    12471201  this->outputFraction = 1.0f;
    12481202  this->inputStart =  position1;
    1249   this->inputEnd =   dest1;
    1250   this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
     1203//   this->inputEnd =   dest1;                                                 <===============
     1204//  this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );
    12511205
    12521206  if(this->outputFraction < 1.0f) {
     
    12701224
    12711225
    1272       // 3rd Collision Detection Z-RAY
    1273   this->outputStartsOut = true;
    1274   this->outputAllSolid = false;
    1275   this->outputFraction = 1.0f;
    1276   this->inputStart =  position2;
    1277   this->inputEnd =   dest2;
    1278 
    1279   this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 );
    1280       //out.x = this->outputFraction;
    1281 
    1282   if(this->outputFraction < 1.0f ) {
    1283     out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction;
    1284     dest2 = position2 + (dest2 -position2) * this->outputFraction;
    1285     zCollision = true;
    1286     testPlane = this->collPlane;
    1287 
    1288   }
    1289   if(this->outputAllSolid ) {
    1290     this->collPlane = new plane;
    1291     this->collPlane->x = 0.0f;
    1292     this->collPlane->y = 0.0f;
    1293     this->collPlane->z = 0.0f;
    1294     testPlane = this->collPlane;
    1295 
    1296     SolidFlag = true;
    1297     zCollision = true;
    1298   }
    1299 
    1300 
    1301   // Return the normal here: Normal's stored in this->collPlane;
    1302   if( collision) {
    1303     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    1304   }
    1305   if(xCollision) {
    1306     worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
    1307   }
    1308 
    1309   if(zCollision) {
    1310     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
    1311   }
     1226  if( xCollision) {
     1227    entity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, entity,
     1228                                   Vector(testPlane->x, testPlane->y, testPlane->z),dest1 ,
     1229                                   SolidFlag);
     1230  }
     1231
    13121232}
    13131233
Note: See TracChangeset for help on using the changeset viewer.