- Timestamp:
- Jul 4, 2006, 1:49:43 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/lib/graphics/importer/bsp_manager.cc
r9081 r9084 1151 1151 1152 1152 bool SolidFlag = false; 1153 bool collision = false; 1154 Vector position1 = position; 1155 Vector position2 = position + Vector(0.0,1.0,0.0); 1156 Vector position3 = position; 1157 Vector position4 = position + Vector(0.0,1.0,0.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 dest = position - Vector(0.0, 40.0,0.0); 1163 Vector out = dest; 1164 Vector out1; 1165 Vector out2; 1166 1167 1168 plane* testPlane; 1153 1154 plane* testPlane = NULL; 1169 1155 1170 1156 bool xCollision = false; 1171 bool zCollision = false; 1157 1172 1158 1173 1159 Vector left; //!< left collision ray 1174 1160 Vector right; //!< right collision ray 1175 1176 Vector dest1; 1177 1178 float height = 40; 1161 Vector collPos; //!< the collision position 1162 1163 1164 1179 1165 1180 1166 Vector dirX = entity->getAbsDirX(); dirX.y = 0.0f; dirX.normalize(); … … 1187 1173 else 1188 1174 { 1189 left = position + forwardDir*4.0f; 1190 right = position2 + forwardDir*4.0; 1191 } 1192 1193 // 1175 Vector position2 = position + Vector(0.0, 1.0,0.0); 1176 Vector position3 = position; 1177 Vector position4 = position + Vector(0.0, 1.0, 0.0); 1178 1179 left = position + forwardDir * 4.0f; 1180 right = position2 + forwardDir * 4.0; 1181 } 1182 1194 1183 // dest1 1195 1184 // dest2 1196 1185 1197 1186 1198 // 2nd Collision Detection X-RAY 1187 /* X Ray Left */ 1188 // init some member variables before collision check 1199 1189 this->outputStartsOut = true; 1200 1190 this->outputAllSolid = false; 1201 1191 this->outputFraction = 1.0f; 1202 this->inputStart = position1; 1203 // this->inputEnd = dest1; <=============== 1204 // this->checkCollisionRayN(this->root,0.0f,1.0f, &position1, &dest1 ); 1205 1206 if(this->outputFraction < 1.0f) { 1207 out.x = dest1.x + (dest1.x -position1.x) * this->outputFraction; 1208 dest1 = position1 + (dest1 -position1) * this->outputFraction; 1192 this->inputStart = position; 1193 this->inputEnd = right; 1194 this->checkCollisionRayN(this->root,0.0f,1.0f, &position, &right ); 1195 1196 // collision occured 1197 if( this->outputFraction < 1.0f) 1198 { 1199 collPos = position + (right - position) * this->outputFraction; 1209 1200 xCollision = true; 1210 1201 testPlane = this->collPlane; 1211 1202 } 1212 if(this->outputAllSolid ) {1213 1203 if(this->outputAllSolid ) 1204 { 1214 1205 this->collPlane = new plane; 1215 1206 this->collPlane->x = 0.0f; … … 1220 1211 xCollision = true; 1221 1212 } 1222 //out.z = this->outputFraction; 1223 1224 1225 1213 1214 // collision registration 1226 1215 if( xCollision) { 1227 entity->registerCollision(COLLISION_TYPE_AXIS_X , this->parent, entity, 1228 Vector(testPlane->x, testPlane->y, testPlane->z),dest1 , 1229 SolidFlag); 1216 entity->registerCollision(COLLISION_TYPE_AXIS_X , 1217 this->parent, entity, 1218 Vector(testPlane->x, testPlane->y, testPlane->z), 1219 collPos, 1220 SolidFlag); 1230 1221 } 1231 1222
Note: See TracChangeset
for help on using the changeset viewer.