HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Measuring the height of the ground

10-11-2008, 12:53 AM#1
Bumster
Hi everyone,

I'd like to measure the Z-height of the ground at a point. My terrain maker has made me a map that uses no actual cliffs; only variations in the ground height. So I can't use GetTerrainCliffLevel to solve this.

If you move your cursor around in the terrain editor in the bottom left there's a Point: "(x,y,z)" label. I'm trying to get the z coordinate of that into my jass code somehow.

The only thing I've been able to find so far is to use GetCameraTargetPositionZ(). This seems to return the correct value, but it only works for the point that's currently in the middle of the camera. My understanding is that you can only manipulate the camera in a single-player game, so this is no good (otherwise I could move the camera of a computer player to find the value).

Does anyone have any ideas for how I can do this?
10-11-2008, 01:02 AM#2
Zandose
There's a function call GetLocationZ.
Collapse JASS:
function Something takes nothing returns nothing
    local location l = Location(0, 0) //Center of map
    local real z = GetLocationZ(l)
    call BJDebugMsg(R2S(z))
    //Cleanup
    call RemoveLocation(l) //Clears a leak
    set l = null //Same
endfunction
10-11-2008, 01:12 AM#3
Bumster
lol!

sigh... can't believe I managed to miss that...


thanks
10-11-2008, 05:45 AM#4
ADOLF
Collapse JASS:
globals
 location lx=Location(0., 0.)
endglobals

 // --->
 call MoveLocation(lx, <x>, <y>)
 set z=GetLocationZ(lx)
 // <---

faster and more compactly ;)