HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Projectile Same Height?

07-07-2009, 01:02 PM#1
Joker
How do you keep a projectile in a straight line, rather than it dropping under cliffs.
07-07-2009, 01:03 PM#2
Anachron
Checking its position everytime, setting the height to Terrain Height + Unit Fleight Height.
07-07-2009, 09:03 PM#3
TKF
I have the same problem, but I don't understand what you mean...
07-07-2009, 10:02 PM#4
Anachron
I meant, use a periodic timer and use this bj:
GetLocationZ(). Its really awful to use BJs but there is no native doing that.
Also check GetUnitFleightHeight() or how it was called, and convert them together, so the unit will everytime fly above the terrain with height x.
07-07-2009, 10:39 PM#5
Anitarf
Umm, GetLocationZ() is a native, not a bj...

What you need to do in order for a unit to maintain constant height z is to periodically set the unit's flying height to (z-GetLocationZ(GetUnitPosition(u))). Of course, that's just the general idea, in practice GetUnitPosition() would leak a location this way so we need to take steps to prevent that.

Note that the unit should not be a flying unit since the flying height of flying units gets smoothed over rapid terrain height changes, use the hover movement type instead; you may need to use the Crow Form trick to be able to change the flying height of a hovering unit.
07-08-2009, 07:12 AM#6
Anachron
Quote:
Originally Posted by Anitarf
Umm, GetLocationZ() is a native, not a bj...

What you need to do in order for a unit to maintain constant height z is to periodically set the unit's flying height to (z-GetLocationZ(GetUnitPosition(u))). Of course, that's just the general idea, in practice GetUnitPosition() would leak a location this way so we need to take steps to prevent that.

Note that the unit should not be a flying unit since the flying height of flying units gets smoothed over rapid terrain height changes, use the hover movement type instead; you may need to use the Crow Form trick to be able to change the flying height of a hovering unit.
Dude, thats exactly what I said...
... about the native: How can it be a native, if it requires a location instead of 2 reals, while there is no other native doing it? (All need realX and realY). Additionally, the JassHelper colours it red, marking it as BJ.
07-08-2009, 08:04 AM#7
Anachron
Quote:
Originally Posted by Litany
a) That's not exactly what you said, and b) it's a native.
  • So why is it coloured as BJ then?
  • It isn't the exact words, but its what I meant.
  • Your post has nothing to do with the question, so you might not post it next time

[/EndOfDiscussion]
07-08-2009, 09:34 AM#8
Strilanc
Be aware there are some issues maintaining a constant height near cliffs. You need to change the unit's Z sampling settings in the object editor. I forget exactly what the options are, but I think you want one sample point with a range of 0.

Quote:
Originally Posted by Anachron
[list][*]So why is it coloured as BJ then?

GetLocationZ is a native.
http://jass.sourceforge.net/doc/api/...rce.shtml#1001

Looking things up helps us not look stupid! *Crowd gasps*
07-08-2009, 09:59 AM#9
Anachron
Quote:
It isn't.
Err, I gonna check it, maybe I changed it myself. Sorry.

Quote:
Then you should have said what you meant.
I said it in other words, that should be enough

Quote:
Your tangent about bjs and your reply to Anitarf had nothing to do with the question. They were also both wrong. It's never off-topic to correct someone who's wrong. If you'll refrain from being wrong, I'll refrain from correcting you.
It actually does, while it affects the efficence of the code you can code to set a missles height to the same value, which is, what he was asking for.

Quote:
Obviously not.
I didn't meant it ended, but I meant it should.
07-08-2009, 02:34 PM#10
TKF
Sry I'm only familiar to GUI.
07-08-2009, 09:11 PM#11
Anitarf
Quote:
Originally Posted by TKF
Sry I'm only familiar to GUI.
You're out of luck then, GetLocationZ is only a JASS function.