Changeset 8220 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer
- Timestamp:
- Jun 7, 2006, 11:44:50 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8219 r8220 83 83 this->root = this->bspFile->get_root(); 84 84 this->alreadyVisible = new bool [this->bspFile->numFaces]; 85 86 this->outputFraction = 1.0f; 85 87 } 86 88 /* … … 853 855 854 856 Vector position = worldEntity->getAbsCoor(); 855 856 857 Vector forwardDir = worldEntity->getAbsDirX(); 858 forwardDir.x =8.0*forwardDir.x; 859 forwardDir.y =8.0*forwardDir.y; 860 forwardDir.z =8.0*forwardDir.z; 861 862 Vector upDir = worldEntity->getAbsDirY(); 863 Vector dest = position; 864 dest.x += forwardDir.x; 865 dest.y += forwardDir.y; 866 dest.z += forwardDir.z; 867 Vector out = dest; 857 Vector downDir = worldEntity->getAbsDirY(); 858 Vector dest = position + downDir * -80.0f; 859 860 // Vector forwardDir = worldEntity->getAbsDirX(); 861 // forwardDir.x =8.0*forwardDir.x; 862 // forwardDir.y =8.0*forwardDir.y; 863 // forwardDir.z =8.0*forwardDir.z; 864 // 865 // Vector upDir = worldEntity->getAbsDirY(); 866 // Vector dest = position; 867 // dest.x += forwardDir.x; 868 // dest.y += forwardDir.y; 869 // dest.z += forwardDir.z; 870 // Vector out = dest; 868 871 869 872 bool collision = false; 870 873 871 Vector position1 = position + Vector(0.0,0.1,0.0); 872 Vector position2 = position + Vector(0.0,0.2,0.0); 873 Vector dest1 = position1 + forwardDir; 874 Vector dest2 = position2 + forwardDir; 875 dest = position - Vector(0.0, 20.0,0.0); 876 Vector out1; 877 Vector out2; 878 879 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 880 if(this->outputFraction == 1.0f) out1 = dest; 874 875 // Vector position1 = position + Vector(0.0,0.1,0.0); 876 // Vector position2 = position + Vector(0.0,0.2,0.0); 877 // Vector dest1 = position1 + forwardDir; 878 // Vector dest2 = position2 + forwardDir; 879 // dest = position - Vector(0.0, 20.0,0.0); 880 // Vector out1; 881 // Vector out2; 882 883 // this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 884 // if(this->outputFraction == 1.0f) out1 = dest; 885 // else { 886 // collision = true; 887 // out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 888 // out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 889 // out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 890 // 891 // } 892 // this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 893 // if(this->outputFraction == 1.0f) out2= dest; 894 // else { 895 // collision = true; 896 // out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 897 // out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 898 // out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 899 // 900 // } 901 902 this->checkCollisionRayN(this->root,0.0f, 1.0f, &position, &dest ); 903 904 if( this->outputFraction == 1.0f) 905 out = dest; 881 906 else { 907 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 882 908 collision = true; 883 out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 884 out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 885 out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 886 887 } 888 889 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 890 if(this->outputFraction == 1.0f) out2= dest; 891 else { 892 collision = true; 893 out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 894 out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 895 out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 896 897 } 898 899 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 900 if(this->outputFraction == 1.0f) out = dest; 901 else { 902 collision = true; 903 out.x = position.x + (dest.x -position.x) * this->outputFraction; 904 out.y = position.y + (dest.y -position.y) * this->outputFraction; 905 out.z = position.z + (dest.z -position.z) * this->outputFraction; 909 // out.x = position.x + (dest.x -position.x) * this->outputFraction; 910 // out.y = position.y + (dest.y -position.y) * this->outputFraction; 911 // out.z = position.z + (dest.z -position.z) * this->outputFraction; 912 913 out = position + (dest - position) * this->outputFraction; 906 914 907 915 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 908 this->out = out; 909 this->out1 = out1; 910 this->out2 = out2; 916 917 911 918 //this->drawDebugCube(&out1); 912 919 //this->drawDebugCube(&out2); … … 917 924 918 925 // Return the normal here: Normal's stored in this->collPlane; 919 if( collision)926 if( collision) { 920 927 worldEntity->registerCollision(worldEntity, this->parent, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 928 } 921 929 } 922 930
Note: See TracChangeset
for help on using the changeset viewer.