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

Possible to check height of terrain? And need ideas for my projectile system

Status
Not open for further replies.
Level 5
Joined
Dec 19, 2004
Messages
110
I'm afraid points don't have a z value so you can't check for that..

But is there another way to check for the height of the terrain at a point?


It is for my projectile system. I made one that works perfectly whenever the terrain is flat. (just goes in a straight line until it collides with something)

But it looks kinda odd when the terrain goes up and the projectile (arrow) also goes up..

So I'm looking for good suggestions to make my projectile system work better with heights..

I was thinking about making the arrow stop when moving to a higher ground, and allowing it to move further when moving to a lower ground. Also when shooting it over cliffs. And I'd like to make the arrow fly 'smoothly' from high to low if it's possible... Any ideas?
 
Level 14
Joined
Apr 20, 2009
Messages
1,543
khamarr3524 said:
Not certain, but play around with GetUnitFlyHeight() and LocationZ() . You might find something. I don't normally dwell in parabolic spells.

Actually the syntax is GetLocationZ() and yes, it does return the actual z value of the terrain at a given location:

JASS:
native GetLocationZ takes location whichLocation returns real

Hint: you can use the position of dummy units to calculate the terrain height at a certain location. This could obviously help solve your issue.
Example:
JASS:
call GetLocationZ(udg_Cliffdummy)
where Cliffdummy is a GUI point variable stored with the position of a unit.
To use that value you could store it in a variable like this:
JASS:
set udg_CliffHeight = GetLocationZ(udg_Cliffdummy)
where CliffHeight is a GUI real variable.

Neofight said:
And I'd like to make the arrow fly 'smoothly' from high to low if it's possible... Any ideas?
You might want to use a parabola equation in order to make an arch for the arrow.
(http://en.wikipedia.org/wiki/Parabola)

Remember that you do have to make the missile (dummy unit) face to the right direction while it is traversing through the parabola.

I remember a good friend of mine doing this exact same thing some time ago. His name is shadowvzs.
The last time I checked he was working on it in this thread: http://www.hiveworkshop.com/forums/requests-341/request-dummy-mdx-z-angle-formula-213669/
Contact him for more info ;)

Neofight said:
I was thinking about making the arrow stop when moving to a higher ground, and allowing it to move further when moving to a lower ground.
Could you elaborate, what exactly do you mean? A graphical display would eager my ignorance.
 
Last edited:
Level 5
Joined
Dec 19, 2004
Messages
110
Thank you both for replying!

Well in fact, the thing what would be the most awesome, is a realistic arrow that flies in a light arc and damages a unit when colliding.

I now made a unit that goes in a straight line (so in fact a 2D projectile system) but it would be awesome if it is 3D, so an archer can also hit a unit that is on a higher or lower terrain.

But I can only GUI (and of course I know a little jass for custom scripts, like leak removal etc, but that's it) I can think of a way to make the arrow dummy-unit fly in an arc by adjusting the flying height. But when it flies to a higher terrain level, it will also fly higher. So flying height should be minus the cliff height.

So I'll try it with the GetLocationZ, thnx!

Or is there maybe some system already that I can use?

-edit-
Added a drawing of my current system (the first one) where you can see that it looks very ugly when shooting an arrow over a terrain with different heights.

Then the second one is with some little changes, to make it a bit better (make it able to go down the hill only, not up the hill. and make it fly with a less steep angle than the terrain)

The third one is what would be the most awesome, but then I need to drastically change the system, or even make a whole new one.. Because then you have the ability to shoot over units, and so you have to check the (real-, not flying-) height of the arrow and of the colliding unit etc etc.. So its a 3D projectile system.. I don't know if this is hard to do, but would be awesome!

Btw another question: can you make an arrow face with an angle to up/down?
 

Attachments

  • Arrow.png
    Arrow.png
    18.2 KB · Views: 338
Last edited:
Level 14
Joined
Apr 20, 2009
Messages
1,543
Ok I got it working now! Thank you so much guys!

I only haven't figured out how to change the z-facing of the arrow while in flight.. Somebody knows how to do this?

I have already given you the solution to this in my previous post. It's in the thread I linked.
Checkout this post:
http://www.hiveworkshop.com/forums/2121317-post6.html

By the way could you please post the formula that you've used for the parabola?
I'm rather interested in how you solved your problem.
 
Level 5
Joined
Dec 19, 2004
Messages
110
Obviously I do use the Archer missile model for my arrow (which is a dummy unit)

But the arrow/unit can only point like horizontal. But when it flies in an arc (so up and down) it should point to up and down too.

Am I so unclear? Otherwise I'll make a drawing :)
 
Status
Not open for further replies.
Top