• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Get unit elevation

Status
Not open for further replies.

EdgeOfChaos

E

EdgeOfChaos

So I'm not sure if this is possible, but I need to do this (or a suitable workaround)

I want to detect the Z value of a unit. I don't mean the Z value of the point the unit is standing on, but the value of the unit itself. These two are not necessarily the same value for flying units with zero fly-height.

My intent is to make a falling system where the character can fall off a cliff but not climb back up. I need to detect the difference between the character's Z value and the ground's Z value to see if it needs to fall, or to see if it should be prevented from climbing. Any way to do this?
 
There is the native

native GetTerrainCliffLevel takes real x, real y returns integer

which returns the cliff level of x/y coordinates, I guess it would do it. But just in example, if a there is a cliff, and then a flat area ( lower cliff level). And in the flat area there is s strongly raised terrain height, then then actual "Z" coordinate might still be highter on the lower based cliff level terrain than on the higher cliff itself. - If you also need to encounter these scenarios, then

native GetLocationZ takes location whichLocation returns real

should still bring the correct Z value of current terrain. No unit height is involved here, but plain terrain height, taking cliff level and raised terrain into account.
 
Status
Not open for further replies.
Top