Changeset 8343 in orxonox.OLD for branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
- Timestamp:
- Jun 13, 2006, 4:04:33 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8341 r8343 885 885 886 886 887 if(/*!worldEntity->isA(CL_PLAYABLE)*/ false) { 888 889 890 887 888 889 bool collision = false; 890 Vector position1 = position + Vector(0.0,0.1,0.0); 891 Vector position2 = position + Vector(0.0,0.2,0.0); 892 Vector dest1 = position1 + forwardDir; 893 Vector dest2 = position2 + forwardDir; 894 dest = position - Vector(0.0, 40.0,0.0); 895 Vector out1; 896 Vector out2; 897 898 899 float height = 40; 900 this->outputAllSolid = false; 901 902 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 903 904 PRINTF(0)(" checking collision: %s, solid = %i, fraction = %f\n", worldEntity->getClassName(), this->outputAllSolid, this->outputFraction); 905 // position1.debug(); 906 907 if( this->outputFraction == 1.0f) 908 { 909 if(this->outputAllSolid) 910 { 911 this->collPlane = new plane; 912 this->collPlane->x = 1.0f; 913 this->collPlane->y = 0.0f; 914 this->collPlane->z = 0.0f; 915 collision = true; 916 } 917 else 918 collision = false; 919 920 921 out = dest; 891 922 } 892 923 else { 893 924 894 bool collision = false; 895 Vector position1 = position + Vector(0.0,0.1,0.0); 896 Vector position2 = position + Vector(0.0,0.2,0.0); 897 Vector dest1 = position1 + forwardDir; 898 Vector dest2 = position2 + forwardDir; 899 dest = position - Vector(0.0, 40.0,0.0); 900 Vector out1; 901 Vector out2; 902 903 904 float height = 40; 905 this->outputAllSolid = false; 906 907 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 908 909 if( this->outputFraction == 1.0f) 910 { 911 if(this->outputAllSolid) 912 { 913 this->collPlane = new plane; 914 this->collPlane->x = 1.0f; 915 this->collPlane->y = 0.0f; 916 this->collPlane->z = 0.0f; 917 collision = true; 918 } 919 else 920 collision = false; 921 922 923 out = dest; 924 } 925 else { 926 927 collision = true; 928 out.x = position.x + (dest.x -position.x) * this->outputFraction; 929 out.y = position.y + (dest.y -position.y) * this->outputFraction; 930 out.z = position.z + (dest.z -position.z) * this->outputFraction; 931 932 Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z); 933 this->out = out; 934 //this->out1 = out1; 935 //this->out2 = out2; 936 //this->drawDebugCube(&out1); 937 //this->drawDebugCube(&out2); 938 //this->drawDebugCube(&out3); 939 } 940 // Return the normal here: Normal's stored in this->collPlane; 941 if(collision ) { 942 // PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 943 worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 944 } 925 collision = true; 926 out.x = position.x + (dest.x -position.x) * this->outputFraction; 927 out.y = position.y + (dest.y -position.y) * this->outputFraction; 928 out.z = position.z + (dest.z -position.z) * this->outputFraction; 929 930 Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z); 931 this->out = out; 932 } 933 934 // Return the normal here: Normal's stored in this->collPlane; 935 if( collision) { 936 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 937 worldEntity->registerCollision(this->parent, worldEntity, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 945 938 } 946 939
Note: See TracChangeset
for help on using the changeset viewer.