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

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