| 987 | } |
| 988 | |
| 989 | bool BattleUnit::hasLineToUnit(const sp<BattleUnit> unit, bool useLOS) const |
| 990 | { |
| 991 | auto muzzleLocation = getMuzzleLocation(); |
| 992 | auto targetPosition = unit->tileObject->getVoxelCentrePosition(); |
| 993 | if (unit->isLarge()) |
| 994 | { |
| 995 | // Offset search for large units as they can get caught up in ground |
| 996 | // that is supposed to allow units to go through it but blocks LOS |
| 997 | auto targetvVectorDelta = glm::normalize(targetPosition - muzzleLocation) * 0.75f; |
| 998 | targetPosition -= targetvVectorDelta; |
| 999 | } |
| 1000 | return hasLineToPosition(targetPosition, useLOS); |
| 1001 | } |
| 1002 | |
| 1003 | bool BattleUnit::hasLineToPosition(Vec3<float> targetPosition, bool useLOS) const |
| 1004 | { |
no test coverage detected