1 (edited by CELL9 2023-05-17 00:06:17)

Topic: Terrain mesh collider, horizon elevation cache

Hello, I have a couple of issues.

1.
With elevation enabled, the enemy field of view is obstructed by the terrain so it cannot see the player behind hills. But since I made them not get hidden outside map boundaries when the player is near (so you cannot hide from them by looking away or zooming in), it causes another issue. When zoomed in too much or if moving the map view too far away the enemy will now see the player since the terrain disappear outside the map bounds.

Example: https://www.youtube.com/watch?v=dVJTjiXMa2w (Warning: Potentially loud gunshots)

How do you think I should solve this?

2.
I'm still using bing elevations as I have yet to implement a custom elevation source, I have enabled caching which works, but it seems that the Horizon2_BingMaps doesn't use the cached elevation.

Re: Terrain mesh collider, horizon elevation cache

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.