| 552 | } |
| 553 | |
| 554 | bool TestBoundsCollide(ItemInfo* item, ItemInfo* laraItem, int radius) |
| 555 | { |
| 556 | const auto& bounds = GetClosestKeyframe(*item).BoundingBox; |
| 557 | const auto& playerBounds = GetClosestKeyframe(*laraItem).BoundingBox; |
| 558 | |
| 559 | if (bounds.GetExtents() == Vector3::Zero || playerBounds.GetExtents() == Vector3::Zero) |
| 560 | return false; |
| 561 | |
| 562 | if ((item->Pose.Position.y + bounds.Y2) <= (laraItem->Pose.Position.y + playerBounds.Y1)) |
| 563 | return false; |
| 564 | |
| 565 | if ((item->Pose.Position.y + bounds.Y1) >= (laraItem->Pose.Position.y + playerBounds.Y2)) |
| 566 | return false; |
| 567 | |
| 568 | float sinY = phd_sin(item->Pose.Orientation.y); |
| 569 | float cosY = phd_cos(item->Pose.Orientation.y); |
| 570 | |
| 571 | int x = laraItem->Pose.Position.x - item->Pose.Position.x; |
| 572 | int z = laraItem->Pose.Position.z - item->Pose.Position.z; |
| 573 | int dx = (x * cosY) - (z * sinY); |
| 574 | int dz = (z * cosY) + (x * sinY); |
| 575 | |
| 576 | if (dx >= (bounds.X1 - radius) && |
| 577 | dx <= (bounds.X2 + radius) && |
| 578 | dz >= (bounds.Z1 - radius) && |
| 579 | dz <= (bounds.Z2 + radius)) |
| 580 | { |
| 581 | return true; |
| 582 | } |
| 583 | |
| 584 | return false; |
| 585 | } |
| 586 | |
| 587 | bool TestBoundsCollideStatic(ItemInfo* item, const StaticMesh& mesh, int radius) |
| 588 | { |
no test coverage detected