• 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.

Making units ignore terrain height

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I have a spell that summons a fireball out of the ground and throws it around. It works fine on flat terrain, but if I do it near cliffs, trees or other doodads it will be summoned up in the air.

I use a dummy flying unit, setting its height to 10. I then have a trigger raise the height over time. Again, it works okay on flat terrain.

How do I get the unit it ignore the terrain around it for purposes of height? I tried setting sampling radius to 0, tried turning off collision with a trigger, tried setting pathing collison to 0 in the object editor... none of that worked.
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
This is what I would do:

Use the following Jass native in order to get the z height of your terrain at a given location:

JASS:
native GetLocationZ takes location whichLocation returns real

How to use it?

  • Custom script: set udg_MyGUIHeightVariable = GetLocationZ(udg_MyGUILocationVariable)
Where MyGUIHeightVariable is a real variable and MyGUILocationVariable is a point variable.

This can then be used to calculate the difference between the z height of terrain for at for example the position of your unit and the position of a dummy unit placed upon a cliff.

You can set the flying height of the unit to the difference of these two locations with a customized offset to make it look good.
 
Level 14
Joined
Aug 30, 2004
Messages
909
Ah, thank you both. Setting movement to NONE worked and I don't know JASS well, so I'll just stick with that. +rep to you both though, thanks.

Changing height over time isn't anything fancy...just a repeat timer that moves it up point by point.
 
Status
Not open for further replies.
Top