| 1334 | } |
| 1335 | |
| 1336 | int EnvObject::lineCheck(const vec3& start, const vec3& end, vec3* point, vec3* normal) { |
| 1337 | if (selected_) { |
| 1338 | if (!sphere_line_intersection(start, end, sphere_center_, sphere_radius_)) { // Much faster than the OBB check, and most objects probably won't fall under cursor |
| 1339 | return -1; |
| 1340 | } |
| 1341 | return LineCheckEditorCube(start, end, point, normal); |
| 1342 | } |
| 1343 | if (bullet_object_) { |
| 1344 | return GetBulletWorld()->CheckRayCollisionObj(start, end, *bullet_object_, point, normal); |
| 1345 | } |
| 1346 | if (model_id_ == -1 || |
| 1347 | !sphere_line_intersection(start, end, sphere_center_, sphere_radius_)) { |
| 1348 | return -1; |
| 1349 | } |
| 1350 | const Model& model = Models::Instance()->GetModel(model_id_); |
| 1351 | int intersecting = model.lineCheckNoBackface(invert(transform_) * start, |
| 1352 | invert(transform_) * end, |
| 1353 | point, |
| 1354 | normal); |
| 1355 | if (intersecting != -1) { |
| 1356 | if (point) { |
| 1357 | *point = transform_ * *point; |
| 1358 | } |
| 1359 | if (normal) { |
| 1360 | *normal = GetRotation() * *normal; |
| 1361 | } |
| 1362 | } |
| 1363 | return intersecting; |
| 1364 | } |
| 1365 | |
| 1366 | void EnvObject::Moved(Object::MoveType type) { |
| 1367 | Object::Moved(type); |
nothing calls this directly
no test coverage detected