| 08-22-2007, 10:09 PM | #1 |
JASS://============================================================================== function GetUnitZ takes unit u returns real call MoveLocation( LocationZ ,GetUnitX(u),GetUnitY(u) ) return GetLocationZ(LocationZ) + GetUnitFlyHeight(u) endfunction //============================================================================== function SetUnitZ takes unit u,real z returns nothing call MoveLocation( LocationZ ,GetUnitX(u),GetUnitY(u) ) call SetUnitFlyHeight(u,z-GetLocationZ(LocationZ),0) endfunction Is there any better way to do this stuff? |
| 08-22-2007, 10:18 PM | #2 |
inline it... // + omg such function i use allready for a long time. thats the effect of "i will do my stuff self..." + syntax error NOT return GetLocationZ( LocationZ + GetUnitFlyHeight(u) ) SO return GetLocationZ(LocationZ)+GetUnitFlyHeight(u) |
| 08-22-2007, 10:20 PM | #3 |
Hey, here's an idea. Put them in globals, easier and faster, wow. Here it is: function SetUnitZ takes structedunit u, real z returns nothing call MoveLocation(loc, u.x, u.y) set u.z = z call SetUnitFlyHeight(u.u,u.z+GetLocationZ(u.u),0) endfunction function GetUnitZ takes structedunit u returns real return u.z endfunction That way, you could even do without these function, saves alot of cpu again. |
| 08-22-2007, 10:27 PM | #4 |
How did I make that syntax error while copying ??? nwm, Anyways I will not use X/Y globals because the engine would not be flexible enough then. (It will not be able to handle multiple move vectors at once) May I ask again, is there any other way to do this or not? (besides of optimizations) EDIT: Ah I can't use global X and Y, but that global Z would come in handy. Thank you. EDIT2: I have seen some people use SetUnitX, SetUnitY instead of SetUnitPosition is there some good reason for this or is it just their preference |
| 08-22-2007, 10:34 PM | #5 | ||
Quote:
INLINE IT ! no call this functions just do that calcs in needed function!? Quote:
+ GetUnitZ aka new DoNothing() (in your case) |
| 08-22-2007, 10:43 PM | #6 |
I will inline it AFTER I am sure it is working properly. |
| 08-22-2007, 10:59 PM | #7 |
O_O you are not sure what it works perfectly... NOTHING IS PERFECT ! you will see ^^ (what is made by humans hands etc...) |
| 08-22-2007, 11:07 PM | #8 |
JASS://============================================================================== function GetUnitZ takes unit u returns real call MoveLocation( LocationZ ,GetUnitX(u),GetUnitY(u) ) return GetLocationZ(LocationZ) + GetUnitFlyHeight(u) endfunction //============================================================================== function SetUnitZ takes unit u,real z returns nothing call MoveLocation( LocationZ ,GetUnitX(u),GetUnitY(u) ) call SetUnitFlyHeight(u,z-GetLocationZ(LocationZ),0) endfunction OK THIS IS NOT WORKING. When I go over edges it bumps up and down just like when I use flyingHeight only, if it is going to do the same shit as flyingHeight then why do I need GetLocationZ after all? And that optimizations with global Z was moving even worse. |
| 08-22-2007, 11:12 PM | #9 |
what kind of units are you using ? are they... flying units ? |
| 08-22-2007, 11:16 PM | #10 |
I am using ground units in combination with 'Amrf' EDIT: My mistake I was testing on too high ground. This is working: JASS://============================================================================== function SetUnitZ takes unit u,real z returns nothing call MoveLocation( LocationZ ,GetUnitX(u),GetUnitY(u) ) call SetUnitFlyHeight(u,z-GetLocationZ(LocationZ),0) endfunction //============================================================================== set data.z = data.z + data.dz call SetUnitZ(data.hero, data.z) Interesting thing.. you cannot set FlyHeight to negative value. Is there any way to do this? (to burrow units below ground) |
| 08-22-2007, 11:24 PM | #11 |
There could be a number of things. Did you set art-elevation-sample radius to 0? Did you try to move it over water? |
| 08-22-2007, 11:32 PM | #12 |
Art-Elevator-Sample-Radius ??? WTF is that now? |
| 08-23-2007, 07:44 AM | #13 |
tell me tat too ani |
| 08-23-2007, 07:55 AM | #14 |
Just wondering... is there a SetLocationZ() sort of function? To set the height without physically manipulating the terrain... |
| 08-23-2007, 08:15 AM | #15 | |
Quote:
Anyway, you figured it out already. And no, you can not burrow units below ground unless you displace their whole model and change the z value accordingly. |
