• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Detect the actual Z value of the ground even under water

Status
Not open for further replies.
Level 28
Joined
Feb 2, 2006
Messages
1,631
Is it really not possible to detect the actual Z value of the seabed below water?

I have already found these threads about this topic:
and there is no solution mentioned. I do not want to go with a fake water surface and flying units since I think that some of Warcraft's functionality will get lost like standard spells as Submerge or the floating units etc. I think that swimming units also add some water effect by default etc. and Warcraft's water might have some additional stuff which I don't know of yet and which might be hard to reproduce.

In this post there is a system mentioned which should return the correct camera offset for every location on the map. It seems to scan the map initially and somehow calculate the correct Z value: [General] - How to make water deeper?
However, this system did not work for under water locations. It works with GetLocationZ() and this function does not return any different Z value if there is a cliff under water.
In my map I have created a rather deep ocean and if I move the camera under water it will automatically get higher on locations where tehre is a cliff under water but GetLocationZ will always return the same value (maybe the one of the water surface?!), so Warcraft's camera system seems to know that there is a cliff but somehow GetLocationZ has special treatment for water areas?

I can only think of these two solutions:
  • Manually add Z offsets for rects where there are cliffs under water: Really much work to do.
  • Somehow move the camera on all locations of the map and get the actual Z value by using some absolute Z value function for the camera height if there is any (I don't know this yet).
I need the exact Z value since I want to have a fixed camera height under water and detect cliffs which are higher than the submerged unit, so it cannot move forward anymore.
Blockers are no option since they will block units above the water!

Here is a screenshot of my map, so you can get a better understanding of the issue (the under water cliffs in the distance should return a different Z than the current location but they don't!):


SubmergeLevel1.png
 
Level 25
Joined
Mar 29, 2020
Messages
1,466
I'm not exactly sure if this will help, but maybe worth a shot - from what I have seen, when you remove a units collision, it will always walk on the seabed (or lowest available terrain).

maybe you can use a dummy unit with no collision as a height detector.
 
Pretty interesting problem. I don't know of any trick to bypass the weird water limitations--imo it'd be best to write a script to process the w3x and compute the height of the terrain at each 32x32 tile (or more/less granular, depending on how you accurate you need it to be). Then dump those results into an array or hashtable.
 
Status
Not open for further replies.
Top