Right now I'm working on a "jump" for my map. The thing itself isn't that hard, I can make the unit move quite realistically over a flat terrain, or when there is a cliff going up or down.
But my problem is, what if there is an obstacle on the parabolas' path? Ie. terrain level at the start and end points is equal, but there is a lone cliff at some point, which makes the unit go higher due to the way Warcraft mechanics work.
In other words (or pictures);
.
Is it even remotely possible to "compensate" for the elevation and make the unit move naturally over such cliffs?
Oh, and regarding code, here are my failourus attempts (only the problematic part);
h is flying height, comp is the difference between cliff heights
In theory, rate of (h + comp) / 0.1 should make the unit go higher/lower with 0.1 sec delay, making it look more smooth... But in practice it doesn't work, or the change is unnoticeable.
(I tried instantly changing units' flying height, it didn't work either)
I don't know, maybe it's my logic failing me in the time of need.
But my problem is, what if there is an obstacle on the parabolas' path? Ie. terrain level at the start and end points is equal, but there is a lone cliff at some point, which makes the unit go higher due to the way Warcraft mechanics work.
In other words (or pictures);
Oh, and regarding code, here are my failourus attempts (only the problematic part);
JASS:
function Knock_Child takes nothing returns nothing
(...)
local real z = GetLocationZ(p)
local real z2 = GetLocationZ(p2)
(...)
if z > z2 then
set comp = z - z2
call SetUnitFlyHeight(u, h + comp, ((h + comp) / 0.1))
else
set comp = z2 - z
call SetUnitFlyHeight(u, h + comp, ((h + comp) / 0.1))
endif
(...)
endfunction
In theory, rate of (h + comp) / 0.1 should make the unit go higher/lower with 0.1 sec delay, making it look more smooth... But in practice it doesn't work, or the change is unnoticeable.
(I tried instantly changing units' flying height, it didn't work either)
I don't know, maybe it's my logic failing me in the time of need.
Last edited:


