Changeset 8221 in orxonox.OLD
- Timestamp:
- Jun 8, 2006, 12:03:27 AM (18 years ago)
- Location:
- branches/bsp_model/src/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/bsp_model/src/lib/collision_reaction/cr_physics_ground_walk.h
r8200 r8221 22 22 23 23 private: 24 24 Vector lastPosition; //!< vector with the last valid position 25 Quaternion lastDireciton; //!< quat with the last valid direction 25 26 }; 26 27 -
branches/bsp_model/src/lib/graphics/importer/bsp_manager.cc
r8220 r8221 84 84 this->alreadyVisible = new bool [this->bspFile->numFaces]; 85 85 86 this->outputFraction = 1.0f; 86 this->outputFraction = 1.0f; //FIXME is this needed? 87 87 } 88 88 /* … … 852 852 void BspManager::checkCollision(WorldEntity* worldEntity) 853 853 { 854 855 856 854 Vector position = worldEntity->getAbsCoor(); 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; 871 872 bool collision = false; 873 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; 906 else { 907 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 908 collision = true; 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; 914 915 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 916 917 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; 868 869 870 871 872 873 874 875 876 877 if(!worldEntity->isA(CL_PLAYABLE)) { 878 879 880 881 } 882 else { 883 884 bool collision = false; 885 Vector position1 = position + Vector(0.0,0.1,0.0); 886 Vector position2 = position + Vector(0.0,0.2,0.0); 887 Vector dest1 = position1 + forwardDir; 888 Vector dest2 = position2 + forwardDir; 889 dest = position - Vector(0.0, 20.0,0.0); 890 Vector out1; 891 Vector out2; 892 893 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 894 if(this->outputFraction == 1.0f) out1 = dest; 895 else { 896 collision = true; 897 out1.x = position1.x + (dest1.x -position1.x) * this->outputFraction; 898 out1.y = position1.y + (dest1.y -position1.y) * this->outputFraction; 899 out1.z = position1.z + (dest1.z - position1.z) * this->outputFraction; 900 901 } 902 903 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 904 if(this->outputFraction == 1.0f) out2= dest; 905 else { 906 collision = true; 907 out2.x = position2.x + (dest2.x -position2.x) * this->outputFraction; 908 out2.y = position2.y + (dest2.y -position2.y) * this->outputFraction; 909 out2.z = position2.z + (dest2.z - position2.z) * this->outputFraction; 910 911 } 912 913 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest ); 914 if(this->outputFraction == 1.0f) out = dest; 915 else { 916 collision = true; 917 out.x = position.x + (dest.x -position.x) * this->outputFraction; 918 out.y = position.y + (dest.y -position.y) * this->outputFraction; 919 out.z = position.z + (dest.z -position.z) * this->outputFraction; 920 921 Vector out3 = out + Vector(3*this->collPlane->x,3*this->collPlane->y,3*this->collPlane->z); 922 this->out = out; 923 this->out1 = out1; 924 this->out2 = out2; 918 925 //this->drawDebugCube(&out1); 919 926 //this->drawDebugCube(&out2); … … 921 928 //this->drawDebugCube(&out3); 922 929 923 }930 } 924 931 925 932 // Return the normal here: Normal's stored in this->collPlane; 926 if( collision) { 927 worldEntity->registerCollision(worldEntity, this->parent, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 928 } 933 934 if(collision) { 935 PRINTF(0)("We got a collision!! Are you sure: outputFraction = %f\n", this->outputFraction); 936 worldEntity->registerCollision(worldEntity, this->parent, Vector(this->collPlane->x, this->collPlane->y, this->collPlane->z), out); 937 } 938 //worldEntity->collidesWithGround(out,out1,out2); 939 // registerCollision(WorldEntity* entity, Vector(this->collPlane.x, ), Vector position); 940 941 } 942 929 943 } 930 944
Note: See TracChangeset
for help on using the changeset viewer.