Changeset 9081 in orxonox.OLD for branches/presentation/src/lib/graphics/importer
- Timestamp:
- Jul 4, 2006, 1:00:22 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/graphics/importer/bsp_manager.cc
r9080 r9081 1143 1143 { 1144 1144 // Retrieve Bounding box 1145 AABB* box = worldEntity->getModelAABB();1145 AABB* box = entity->getModelAABB(); 1146 1146 1147 1147 1148 1148 Vector forwardDir = Vector(0.0,0.0,1.0); 1149 1149 Vector upDir = Vector(0.0,1.0,0.0); 1150 Vector position = worldEntity->getAbsCoor();1150 Vector position = entity->getAbsCoor(); 1151 1151 1152 1152 bool SolidFlag = false; … … 1156 1156 Vector position3 = position; 1157 1157 Vector position4 = position + Vector(0.0,1.0,0.0); 1158 Vector dest = worldEntity->getAbsCoor() - upDir*40.0f; //1159 1160 Vector dest3 = position + forwardDir *4.0f;1161 Vector dest4 = position2 + forwardDir *4.0;1158 Vector dest = entity->getAbsCoor() - upDir*40.0f; // 1159 1160 Vector dest3 = position + forwardDir * 4.0f; 1161 Vector dest4 = position2 + forwardDir * 4.0; 1162 1162 dest = position - Vector(0.0, 40.0,0.0); 1163 1163 Vector out = dest; … … 1174 1174 Vector right; //!< right collision ray 1175 1175 1176 Vector dest1; 1177 1176 1178 float height = 40; 1177 1179 1178 Vector dirX = worldEntity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize();1180 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); 1179 1181 1180 1182 if( box != NULL) 1181 1183 { 1182 left = worldEntity->getAbsCoor() + box->center + dirX * (box->halfLength[0] + BSP_X_OFFSET);1183 right = worldEntity->getAbsCoor() - box->center + dirX * (box->halfLength[0] + BSP_X_OFFSET);1184 left = entity->getAbsCoor() + box->center + dirX * (box->halfLength[0] + BSP_X_OFFSET); 1185 right = entity->getAbsCoor() - box->center + dirX * (box->halfLength[0] + BSP_X_OFFSET); 1184 1186 } 1185 1187 else … … 1192 1194 // dest1 1193 1195 // dest2 1194 1195 1196 1197 // 1st Ray: Y RAY1198 this->inputStart = position;1199 this->inputEnd = dest;1200 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &dest );1201 1202 1203 //1204 if(!this->outputStartsOut ) {1205 this->collPlane = new plane;1206 this->collPlane->x = 0.0f;1207 this->collPlane->y = 0.0f;1208 this->collPlane->z = 0.0f;1209 collision = true;1210 } else {1211 1212 if( this->outputFraction == 1.0f) {1213 if(this->outputAllSolid ) {1214 this->collPlane = new plane;1215 this->collPlane->x = 0.0f;1216 this->collPlane->y = 0.0f;1217 this->collPlane->z = 0.0f;1218 collision = true;1219 SolidFlag = true;1220 } else1221 collision = false;1222 1223 1224 out = dest;1225 1226 } else {1227 collision = true;1228 out.x = position.x + (dest.x -position.x) * this->outputFraction;1229 out.y = position.y + (dest.y -position.y) * this->outputFraction;1230 out.z = position.z + (dest.z -position.z) * this->outputFraction;1231 1232 Vector out3 = out + Vector(height*this->collPlane->x,height*this->collPlane->y,height*this->collPlane->z);1233 this->out = out;1234 }1235 }1236 testPlane = this->collPlane;1237 1238 1239 bool xCollisionNeg = false;1240 bool zCollisionNeg = false;1241 1242 1196 1243 1197 … … 1247 1201 this->outputFraction = 1.0f; 1248 1202 this->inputStart = position1; 1249 this->inputEnd = dest1; 1250 this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 );1203 // this->inputEnd = dest1; <=============== 1204 // this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 1251 1205 1252 1206 if(this->outputFraction < 1.0f) { … … 1270 1224 1271 1225 1272 // 3rd Collision Detection Z-RAY 1273 this->outputStartsOut = true; 1274 this->outputAllSolid = false; 1275 this->outputFraction = 1.0f; 1276 this->inputStart = position2; 1277 this->inputEnd = dest2; 1278 1279 this->checkCollisionRayN(this->root,0.0f,1.0f, &position2, &dest2 ); 1280 //out.x = this->outputFraction; 1281 1282 if(this->outputFraction < 1.0f ) { 1283 out.z = out.z = dest2.z + (dest2.z -position2.z) * this->outputFraction; 1284 dest2 = position2 + (dest2 -position2) * this->outputFraction; 1285 zCollision = true; 1286 testPlane = this->collPlane; 1287 1288 } 1289 if(this->outputAllSolid ) { 1290 this->collPlane = new plane; 1291 this->collPlane->x = 0.0f; 1292 this->collPlane->y = 0.0f; 1293 this->collPlane->z = 0.0f; 1294 testPlane = this->collPlane; 1295 1296 SolidFlag = true; 1297 zCollision = true; 1298 } 1299 1300 1301 // Return the normal here: Normal's stored in this->collPlane; 1302 if( collision) { 1303 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Y , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), out, SolidFlag); 1304 } 1305 if(xCollision) { 1306 worldEntity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , SolidFlag); 1307 } 1308 1309 if(zCollision) { 1310 worldEntity->registerCollision(COLLISION_TYPE_AXIS_Z , this->parent, worldEntity, Vector(testPlane->x, testPlane->y, testPlane->z), dest2 , SolidFlag); 1311 } 1226 if( xCollision) { 1227 entity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, entity, 1228 Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , 1229 SolidFlag); 1230 } 1231 1312 1232 } 1313 1233
Note: See TracChangeset
for help on using the changeset viewer.