Changeset 8724 in orxonox.OLD for trunk/src/lib/graphics/importer/bsp_manager.cc
- Timestamp:
- Jun 22, 2006, 3:14:58 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/graphics/importer/bsp_manager.cc
r8490 r8724 50 50 BspManager::BspManager(WorldEntity* parent) 51 51 { 52 52 53 53 this->parent = parent; 54 54 /*// open a BSP file … … 840 840 this->checkBrushRayN(&curBrush); 841 841 if(curBrush.n_brushsides <=0) this->outputAllSolid = true; 842 } 842 } 843 843 844 return; 844 845 } … … 907 908 908 909 } 910 911 float BspManager::checkPatchAltitude(BspTreeNode* node) 912 { 913 leaf& curLeaf = this->bspFile->leaves[node->leafIndex]; 914 for(int i = 0; i < curLeaf.n_leaffaces ; i++) 915 { 916 917 } 918 return 10.0f; 919 } 920 909 921 void BspManager::checkCollisionBox(void) 910 922 { … … 937 949 void BspManager::checkCollision(WorldEntity* worldEntity) 938 950 { 939 951 940 952 this->outputStartsOut = true; 941 953 this->outputAllSolid = false; 942 954 this->outputFraction = 1.0f; 943 944 Vector position = worldEntity->getAbsCoor(); 955 956 945 957 946 958 947 959 Vector forwardDir = worldEntity->getAbsDirX(); 948 forwardDir = forwardDir * 8.0f; 960 949 961 950 962 Vector upDir = worldEntity->getAbsDirY(); … … 958 970 dest.z += forwardDir.z; 959 971 */ 960 961 dest = worldEntity->getAbsCoor() - upDir*40.0 ;972 Vector position = worldEntity->getAbsCoor() + upDir*10.0f ; 973 dest = worldEntity->getAbsCoor() - upDir*40.0f; // 962 974 Vector out = dest; 963 975 … … 966 978 967 979 bool collision = false; 968 Vector position1 = position + Vector(0.0,0.1,0.0);969 Vector position2 = position + Vector(0.0, 0.2,0.0);970 Vector dest1 = position 1 + forwardDir;980 Vector position1 = position; // + Vector(0.0,0.6,0.0); 981 Vector position2 = position + Vector(0.0,1.0,0.0); 982 Vector dest1 = position + forwardDir*4.0f; 971 983 Vector dest2 = position2 + forwardDir; 972 984 dest = position - Vector(0.0, 40.0,0.0); … … 976 988 977 989 float height = 40; 978 990 979 991 this->inputStart = position; 980 992 this->inputEnd = dest; 981 993 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 982 983 PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction); 984 PRINTF(0)("checking collision!! Pos.Coords: %f , %f , %f\n", position.x , position.y, position.z); 985 PRINTF(0)("checking collision!! Dest.Coords: %f , %f , %f\n", dest.x , dest.y, dest.z); 994 995 996 997 // PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction); 998 // PRINTF(0)("checking collision!! Pos.Coords: %f , %f , %f\n", position.x , position.y, position.z); 999 // PRINTF(0)("checking collision!! Dest.Coords: %f , %f , %f\n", dest.x , dest.y, dest.z); 1000 986 1001 // position1.debug(); 1002 1003 if(!this->outputStartsOut ) 1004 { 1005 this->collPlane = new plane; 1006 this->collPlane->x = 0.0f; 1007 this->collPlane->y = 0.0f; 1008 this->collPlane->z = 0.0f; 1009 collision = true; 1010 } 1011 else 1012 { 1013 1014 1015 987 1016 988 1017 if( this->outputFraction == 1.0f) 989 1018 { 990 if(this->outputAllSolid )1019 if(this->outputAllSolid ) 991 1020 { 992 1021 this->collPlane = new plane; 993 this->collPlane->x = 1.0f;1022 this->collPlane->x = 0.0f; 994 1023 this->collPlane->y = 0.0f; 995 1024 this->collPlane->z = 0.0f; … … 1013 1042 } 1014 1043 1044 1045 } 1046 1047 plane* testPlane = this->collPlane; 1048 1049 this->outputStartsOut = true; 1050 this->outputAllSolid = false; 1051 this->outputFraction = 1.0f; 1052 this->inputStart = position; 1053 this->inputEnd = dest1; 1054 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest1 ); 1055 out.x = this->outputFraction; 1056 out.z = this->outputFraction; 1057 1058 /* 1059 out.x = position1.x + (dest.x -position1.x) * this->outputFraction; 1060 1061 out.z = position1.z + (dest.z -position1.z) * this->outputFraction; 1062 */ 1063 1064 1015 1065 // Return the normal here: Normal's stored in this->collPlane; 1016 1066 if( collision) { 1017 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 1018 worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 1019 } 1067 PRINTF(5)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 1068 worldEntity->registerCollision(this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out); 1069 } 1070 else worldEntity->registerCollision(this->parent, worldEntity, Vector(0.0, 2.0, 0.0), dest); 1020 1071 1021 1072 }
Note: See TracChangeset
for help on using the changeset viewer.