• 🏆 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!

Camera Moves Down Cliff With Hero

Status
Not open for further replies.
Level 8
Joined
Sep 23, 2007
Messages
357
I am using a third person camera in my map. The camera moves up, at least a little bit, when moving uphill, but when I move downhill the camera stays where it is. I tried searching for camera tutorials but couldn't find any that work in this way.
 
Level 13
Joined
Jun 1, 2008
Messages
360
Regions for every cliff? Have fun ;-)
You can easily get the terrain height and the cliff height with triggers.
  • Set P = (Position of unit)
  • Custom script: set udg_Terrain_Height = GetLocationZ(udg_P)
  • Set Cliff_Height = (Terrain cliff level at P)
  • Custom script: call RemoveLocation(udg_P)
Now do the same thing with some points around the unit, or maybe better: save the previous cliff/terrain height in a hashtable with the unit's key.
Then you know whether it is moving upwards/downwards and can adjust the camera accordingly.

PS: Using the terrain height should be sufficient for this, as higher cliffs also have a higher terrain Z.
 
Level 8
Joined
Sep 23, 2007
Messages
357
Regions for every cliff? Have fun ;-)
You can easily get the terrain height and the cliff height with triggers.
  • Set P = (Position of unit)
  • Custom script: set udg_Terrain_Height = GetLocationZ(udg_P)
  • Set Cliff_Height = (Terrain cliff level at P)
  • Custom script: call RemoveLocation(udg_P)
Now do the same thing with some points around the unit, or maybe better: save the previous cliff/terrain height in a hashtable with the unit's key.
Then you know whether it is moving upwards/downwards and can adjust the camera accordingly.

PS: Using the terrain height should be sufficient for this, as higher cliffs also have a higher terrain Z.

Thanks, this was helpful :)
 
Status
Not open for further replies.
Top