- Joined
- Sep 12, 2008
- Messages
- 657
hey.. some of you might have experienced that whether you move a flying unit,
with height, you notice that whether it goes up a mountain, down a mountain,
a random terrain, or etc, it goes down/up with the terrain.
so that flying unit's in warcraft wont crush,
but is there are a good way to avoid it?
reason that i dont do:
is that because that wont do.
if a unit goes down in terrain, it gets negative values and goes too much up.
if a unit goes up in terrain, it gets positive values,
but some times the positive value is less then the current unit height,
so it still brings me the negative value, and goes up/down.
is there any good way to do this.. i've tried allmost nothing, but gave up and started working on efficency/arc rather then this part of the code ^^
this is how i got UnitZ, and coordinateZ, with 1 global loc that i reuse instead creating/destroying.
oh yeah x and y are globals aswell.
thanks in advance.
with height, you notice that whether it goes up a mountain, down a mountain,
a random terrain, or etc, it goes down/up with the terrain.
so that flying unit's in warcraft wont crush,
but is there are a good way to avoid it?
reason that i dont do:
JASS:
call SetUnitFlyHeight(Unit, GetUnitFlyHight - LocationZ, 0)
is that because that wont do.
if a unit goes down in terrain, it gets negative values and goes too much up.
if a unit goes up in terrain, it gets positive values,
but some times the positive value is less then the current unit height,
so it still brings me the negative value, and goes up/down.
is there any good way to do this.. i've tried allmost nothing, but gave up and started working on efficency/arc rather then this part of the code ^^
JASS:
function GetUnitZ takes unit u returns real
set x = GetUnitX(u)
set y = GetUnitY(u)
call MoveLocation(l, x, y)
return GetLocationZ(l)
endfunction
function GetCoordinateZ takes real x, real y returns real
call MoveLocation(l, x, y)
return GetLocationZ(l)
endfunction
this is how i got UnitZ, and coordinateZ, with 1 global loc that i reuse instead creating/destroying.
oh yeah x and y are globals aswell.
thanks in advance.