| 1258 | } |
| 1259 | |
| 1260 | bool IsPointInCylinder(vector *normal, vector *cylinder_pnt, vector *edir, float elen, const float rad, |
| 1261 | const vector *pnt, vector *mdir, bool *f_collide) { |
| 1262 | float plen = (*pnt - *cylinder_pnt) * *edir; |
| 1263 | |
| 1264 | if (plen < 0.0f || plen > elen) { |
| 1265 | return false; |
| 1266 | } |
| 1267 | |
| 1268 | vector newp = *cylinder_pnt + *edir * plen; |
| 1269 | *normal = *pnt - newp; |
| 1270 | |
| 1271 | if (vm_NormalizeVector(normal) >= rad) { |
| 1272 | return false; |
| 1273 | } |
| 1274 | |
| 1275 | if (*normal * *mdir >= 0.0f) |
| 1276 | *f_collide = false; |
| 1277 | else |
| 1278 | *f_collide = true; |
| 1279 | |
| 1280 | return true; |
| 1281 | } |
| 1282 | |
| 1283 | // check if a sphere intersects a face -- this can be optimized (only need 2d stuff after rotation) |
| 1284 | int check_vector_to_cylinder(vector *colp, vector *intp, float *col_dist, vector *wall_norm, const vector *p0, |
no test coverage detected