• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

How to properly use GetLocationZ

Status
Not open for further replies.
Level 8
Joined
Mar 3, 2009
Messages
327
I use it for my camera system, but when my guy goes up a hill, the camera will change, but it doesnt match the altitude, and it will end up going over the guy's head. I've tried to make it like... GetLocationZ * 0.5 etc, but it doesnt work properly. Is there something i'm missing here?
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
JASS:
native GetLocationZ takes location whichLocation returns real

This function returns the "total" height of the terrain at a given location. If you have a hill then the function will return increasing values depending on how elevated the hill becomes.
 
Level 9
Joined
Jul 3, 2008
Messages
495
It is a little complicated to calculate and set the height between the camera and the unit to always be the same. ( I think. Never really tried it ).

As you can see at the two pictures below, the height between the camera and unit will increase alot when you walk on hills.

Hope you can see my point :)
 

Attachments

  • a1.JPG
    a1.JPG
    19.1 KB · Views: 128
  • a2.JPG
    a2.JPG
    43.4 KB · Views: 122
Level 18
Joined
Jan 21, 2006
Messages
2,552
I only thought you wanted to know what the GetLocationZ function returned, judging by the title of the thread. However, in the scenario you created it would also become a problem if unit was at the bottom of the hill and the camera source was on the hill somewhere.

I worked with cameras a little bit quite some time ago, my memory on how they work is a little faint.

Taking a quick look at the API for WarCraft III cameras it seems there is a function GetCameraEyePositionX along with similar functions for Y and Z values. The problem is there are no functions that control the camera-eye-position. In other words, there are no SetCameraEyePosition functions. Though I haven't given it much thought, you could probably simulate a function like this using camera fields and other camera utilities.
 
Status
Not open for further replies.
Top