• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

missle height smooth possible?

Status
Not open for further replies.
Level 7
Joined
Jun 15, 2010
Messages
218
Is it possible to make a missle fly smooth when terrein height is involed?
I Always set:
real1: Z of current position unit
real2: Z of new position unit
fly height = real1 - real2

Ofcourse it works, but it just doesent look very smooth. Ive downloaded pretty much spells from this site containing a spell with a missle. But none of them are going smooth at terrein Heights.

Is it just not possible?
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
If you have a basic understanding of vJass you can look into Hydra.

The projectile system within keeps the fly height in case the terrain elevates or flattens.
originalZ is the z of the point of creation for that missile.
offset is the missile offset towards the ground.
LocationZ return the TerrainZ, you have to write it yourself.
Doesn't work properly over shallow or deep water terrain.

JASS:
                set z    = LocationZ(x, y) - originalZ
                set f    = -z + offset// Keep the correct fly height,
                                      // in case the terrain elevates or flattens.
               
                call SetUnitFlyHeight(u, f, 0.)
 
Level 7
Joined
Jun 15, 2010
Messages
218
Thanks very much!. Now that i finally know it is possible il try to make it work.
I can read Vjass a bit, but i dont work with it myself. Can this be done in GUI aswell?
About the -z:
Is the z of it the z that was set above?. the Z of new loc - Z of Original loc?
Can i look at the - as a calcuation thing? Like -10 + 5 = -5 ?


About the offset:
What if i want the missle to go straight ahead, then the offset is simply 0?
 
Level 19
Joined
Mar 18, 2012
Messages
1,716
Is the z of it the z that was set above?. the Z of new loc - Z of Original loc?
yes.
Can i look at the - as a calcuation thing? Like -10 + 5 = -5 ?
Again, yes.

What if i want the missle to go straight ahead, then the offset is simply 0?
It means z offset in the z axis and not in x/y axis. "height" would be a better name.
In other words it's the fly height.
 
Level 7
Joined
Jun 15, 2010
Messages
218
cliff%20bug.jpg



I probebly found out what cases my problem. I copied my spell to another map and it worked perfectly. The missle was going smooth. But in the map im working on it doesent go smooth. As you can see in the image, the Cliffs are looking very strange. It is only like this in my map that i work on. Please help me fix this!! Ive spended soo much time on this map
 
There are three basic things required for smooth vertical missile movement. The first is that you set your units movement type to "ground" in the editor, and then add and remove "crow form" ability from it with triggers. This will alow you to set its fly height, even though it is a ground unit. Being a ground unit prevents it from doing some weird sideward movements when changing facing, which flying units otherwise do in wc3.

Second, make sure the maximum pitch/yaw fields are set to 0. This will prevent the unit from aligning to the terrain.

Thirdly, you need the above mentioned GetTerrainZ function. What it does is basically move a location to certain coordinates, then you use a special native function to get its Z coordinate (which will be the same as the terrain Z).

When you make your missile system, make sure you keep all coordinates relative to the map floor, rather than the terrain floor. Like, when you want to create a missile, just set it's z coordinate to GetTerrainZ(x,y) + height offset. Then, as you move it, you can set its fly height to: z - GetTerrainZ(x,y), which is equal to the height above ground. It is quite easy to learn how to use the GetTerrainZ function even while using GUI, you just need to use some global variables for input and output. I can explain more if you need it.
 
Level 7
Joined
Jun 15, 2010
Messages
218
Many thanks Fingolfin. My missles were going pretty smooth already, but its Always better to perfectionate it. I used to get the z with custom script set udg_ball_z2 = GetLocationZ(udg_ball_loc2). Never knew about the terrainZ:) stupid enough i cant give rep before spreading:p
 
Status
Not open for further replies.
Top