Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9065 in orxonox.OLD for branches/presentation/src/lib


Ignore:
Timestamp:
Jul 3, 2006, 7:22:44 PM (18 years ago)
Author:
patrick
Message:

ground collision works again

Location:
branches/presentation/src/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9061 r9065  
    102102          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
    103103          Vector backoff = dirX * front;
    104          
     104
    105105          entity->setAbsCoor(entity->getLastAbsCoor());
    106106         // entity->shiftCoor(backoff);
     
    112112        }
    113113        break;
    114        
     114
    115115      case COLLISION_TYPE_AXIS_X_NEG:
    116116        front = collPos.len() - box->halfLength[0]; // should be [0]
     
    121121          Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();
    122122          Vector backoff = dirX * front * -1.0f;
    123          
     123
    124124          entity->setAbsCoor(entity->getLastAbsCoor());
    125125         // entity->shiftCoor(backoff);
     
    134134
    135135        // collision in the y-axis
    136       case COLLISION_TYPE_AXIS_Y_NEG:
     136      case COLLISION_TYPE_AXIS_Y:
    137137        // calulate the height above ground
    138138        height = collPos.y - box->halfLength[1];
     
    179179        }
    180180        break;
    181        
    182        
     181
     182
    183183         // collision in the z-axis
    184184      case COLLISION_TYPE_AXIS_Z_NEG:
     
    189189        if( side <= 0.0f )
    190190        {
    191          
     191
    192192          Vector dirZ = entity->getAbsDirZ(); dirZ.y = 0.0f; dirZ.normalize();
    193193          Vector backoff = dirZ * side*-1.0f;
  • branches/presentation/src/lib/graphics/importer/bsp_manager.cc

    r9061 r9065  
    985985
    986986
     987  plane* testPlane;
     988
     989  bool xCollision = false;
     990  bool zCollision = false;
     991
    987992
    988993  float height = 40;
     
    9981003    dest1     = worldEntity->getAbsCoor() +  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
    9991004    dest2     = worldEntity->getAbsCoor() -  box->center + dirX * (box->halfLength[0]  + BSP_X_OFFSET);
    1000    
     1005
    10011006    Vector dirZ =  worldEntity->getAbsDirZ(); dirX.y = 0.0f; dirZ.normalize();
    10021007    //position2 = worldEntity->getAbsCoor() +  box->center - dirZ * (box->halfLength[2]  + BSP_Z_OFFSET);
     
    10091014
    10101015
    1011 //   PRINTF(0)("x and v\n");
    1012 //   worldEntity->getAbsDirX().debug();
    1013 //   worldEntity->getAbsDirV().debug();
    1014 
    1015 
    1016   // 1st Ray
     1016
     1017  // 1st Ray: Y RAY
    10171018  this->inputStart =  position;
    10181019  this->inputEnd =   dest;
     
    10521053      this->out = out;
    10531054    }
    1054 
    1055 
    1056   }
    1057 
    1058   plane* testPlane = this->collPlane;
    1059 
    1060   bool xCollision = false;
    1061   bool zCollision = false;
     1055  }
     1056    testPlane = this->collPlane;
     1057
     1058
    10621059  bool xCollisionNeg = false;
    10631060  bool zCollisionNeg = false;
    1064  
    1065 
    1066 
    1067     // 2nd Collision Detection
     1061
     1062
     1063
     1064    // 2nd Collision Detection X-RAY
    10681065    this->outputStartsOut = true;
    10691066    this->outputAllSolid = false;
     
    10931090
    10941091
    1095       // 3rd Collision Detection
     1092      // 3rd Collision Detection Z-RAY
    10961093      this->outputStartsOut = true;
    10971094      this->outputAllSolid = false;
     
    11211118      }
    11221119
    1123   //end if
    1124   /*
    1125   This is how you would calculate the Coordinates where worldEntity Collided with the BSP world.
    1126   out.x = position1.x + (dest.x -position1.x) * this->outputFraction;
    1127   out.z = position1.z + (dest.z -position1.z) * this->outputFraction;
    1128   */
    1129 
    11301120
    11311121  // Return the normal here: Normal's stored in this->collPlane;
    11321122  if( collision) {
    1133     worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y_NEG , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
     1123    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag);
    11341124}
    11351125  if(xCollision) {
    11361126    worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag);
    11371127  }
    1138  
     1128
    11391129  if(zCollision) {
    11401130    worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag);
    11411131  }
    11421132
    1143 
    1144   //else  worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y, this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest, false);
    11451133
    11461134}
Note: See TracChangeset for help on using the changeset viewer.