| 623 | } |
| 624 | |
| 625 | bool afxModel::castRay(const Point3F &start, const Point3F &end, RayInfo* info) |
| 626 | { |
| 627 | if (shape_inst) |
| 628 | { |
| 629 | RayInfo shortest; |
| 630 | shortest.t = 1e8; |
| 631 | |
| 632 | info->object = NULL; |
| 633 | if (mLOSDetails.size() > 0) |
| 634 | { |
| 635 | for (U32 i = 0; i < mLOSDetails.size(); i++) |
| 636 | { |
| 637 | shape_inst->animate(mLOSDetails[i]); |
| 638 | if (shape_inst->castRay(start, end, info, mLOSDetails[i])) |
| 639 | { |
| 640 | info->object = this; |
| 641 | if (info->t < shortest.t) |
| 642 | shortest = *info; |
| 643 | } |
| 644 | } |
| 645 | } |
| 646 | else |
| 647 | { |
| 648 | if (mCollisionDetails.size() > 0) |
| 649 | { |
| 650 | for (U32 i = 0; i < mCollisionDetails.size(); i++) |
| 651 | { |
| 652 | shape_inst->animate(mCollisionDetails[i]); |
| 653 | if (shape_inst->castRay(start, end, info, mCollisionDetails[i])) |
| 654 | { |
| 655 | info->object = this; |
| 656 | if (info->t < shortest.t) |
| 657 | shortest = *info; |
| 658 | } |
| 659 | } |
| 660 | } |
| 661 | } |
| 662 | |
| 663 | if (info->object == this) |
| 664 | { |
| 665 | // Copy out the shortest time... |
| 666 | *info = shortest; |
| 667 | return true; |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | return false; |
| 672 | } |
| 673 | |
| 674 | U32 afxModel::unique_anim_tag_counter = 1; |
| 675 | #define BAD_ANIM_ID 999999999 |