Hi.
1. I would not use map collider for this purpose because it is not reliable.
The horizon collider to use is also a bad idea because you don't know how far the user can scroll the map, and the collider can already be unloaded too.
I would do it that way:
- Imagine a 3x3 grid around the player, with the player in the center. The width of one cell is the maximum shot distance. For example, 1km. So we have a 3x3km area.
- Get coordinates of points to the left, right, top, bottom of the player on half of the total grid size (1.5km).
- Get the coordinates for this area in one request. This will give you an accuracy of about 90 meters per value.
- The player can move within the central cell (1x1km) without new data requests.
- When the player leaves the center cell, a new request for elevation data is made.
- When you need to shoot:
-- If the distance is greater than the maximum, ignore.
-- If the distance is less than the accuracy of the data - hit.
-- If the distance is between, get the shooter and target elevations, and check a few points between them. If there is at least one point with a real height above the line height at the point, then you cannot shoot. Otherwise it is a hit.
If you need more accuracy, you can make requests for each cell separately.
But I think for these purposes this accuracy will be more than enough.
2. Horizon2 Bing Maps has no caching feature.
Caching is pretty easy to add, and it's quite possible I'll implemented it in the future.
If you have implemented the caching yourself, you need to debug your code to understand why cache loading doesn't work.
Kind Regards,
Infinity Code Team.
Boost your productivity a lot and immediately using
Ultimate Editor Enhancer.
Trial and non-commerce versions available.