Open GoogleFrog opened 1 year ago
Related old ticket with the ~same request, but in other words: https://springrts.com/mantis/view.php?id=6427
That isn't the same request. The request there is for a tag that makes an aircraft calculate its altitude relative to sea level, rather than the land underneath. This would be used for really high flying things that want to fly in a flat plane over the map, ignoring mountains.
I was thinking about the comment in that ticket, with the minimum absolute cruise height. At a glance setting minimum absolute cruise height to (innate cruise height for given unit type + X) seems equivalent to setting the plane at height X as a reference water level.
Isnt this what SetSmoothMesh is for?
Aircraft don't need to use smoothmesh since it comes with its own tradeoffs. In particular, ZK doesn't. The request is essentially
-wantedHeight = max( /* water */ 0, someFunctionOfTerrain(x, z));
+wantedHeight = max(CUSTOM_MINIMUM, someFunctionOfTerrain(x, z));
where smoothmesh, if enabled, is included in someFunctionOfTerrain
.
I use a smooth mesh that is less smooth than the default to follow the terrain profile more closely, but also caps the minimum mesh altitude to match the lowest metal spot, to keep stuff flying reasonably high over non-passable areas like lava, void, etc.
@sprunk @GoogleFrog Any specific reason to not use smoothmesh?
Nothing specific, just a whole bunch of factors. The height of aircraft is important and shouldn't be messed with by flying alongside a cliff. Aircraft avoid terrain fine as-is. When I last heard smoothmesh didn't automatically update for terrain.
There are a few maps that would benefit from being able to tell aircraft to treat some XZ plane on the map as the water level. I am thinking of raaar's sky-void maps (eg https://zero-k.info/Maps/Detail/61746) which have sharp cliffs and clouds that planes are meant to fly above, as well as lava maps. For lava maps the parameter would ideally be dynamic, to support maps that raise and lower the lava. Without this parameter maps are prone to submerging low flying gunships in rising lava, which isn't the intention of these maps.
The callout would look something like Spring.SetAircraftHeightReference(height, canLand), and it may as well have an extra canLand parameter to control whether aircraft that can land on water are allowed to land on the height reference. All altitudes etc would be taken from the maximum of this number and the height of the underlying ground. Something would probably have to be done to update the smoothmesh, but idk what it would involve, as I don't use the smoothmesh.
This feature has two advantages over the fuller feature of making water height itself dynamic, even though dynamic water height is a superset of this request. The advantages aren't that great, but may be enough to get this done in lieu of dynamic water height.