HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Unit Running

04-13-2006, 07:15 PM#1
emjlr3
so I am trying to make it look like a unit is actually running when i quickly move them, however, it aint looking so good

for my movement I use

Collapse JASS:
function MoveUnitToPolarProjection takes unit tomove, real dist, real angle returns nothing 
call SetUnitPosition(tomove, GetUnitX(tomove) + dist * Cos(angle * bj_DEGTORAD) , GetUnitY(tomove) + dist * Sin(angle * bj_DEGTORAD)) 
endfunction


then during each run after that I do
Collapse JASS:
call SetUnitAnimation(unit,"walk")

it seems to look ok at first, but no during the whole thing

i tried using SetUnitX/Y instead of SetUnitPosition, but to no avail, any ideas?
04-13-2006, 07:41 PM#2
MaD[Lion]
set unit position will never works, it will lag to hell. use SetUnitX and SetUnitY instead, this is much better. And i dont know why it doesnt work, and how it doesnt work u mean?
04-13-2006, 08:17 PM#3
Captain Griffen
I have come to the conclusion that walk is the most buggy animation ever invented. I've managed only a reasonable approximation that only really works because it lasts very briefly. SetUnitX and SetUnitY do help a lot though.
04-13-2006, 08:38 PM#4
emjlr3
ah figured it out with help from Vile

unit animation indexs are your friends

and setunitx/y isnt neccesary
04-14-2006, 01:06 AM#5
vile
It seems the SetUnitAnimationByIndex loops an animation constantly.
The walk animation isn't looping, it's a one time and thats it.

It is untrue that setunitposition resets animations.
I tend to back off of SetunitX/Y because it gave me weird problems in the past.

So if you plan on playing any animation while moving a unit and you want it to loop, just use the index call.
04-14-2006, 05:41 PM#6
MaD[Lion]
oh sry, SetUnitPosition does work well, i was mixing with SetUnitPositionLoc.

But still SetUnitPosition is slower than SetUnitX and SetUnitY, because i think basically SetUnitPosition also run SetUnitX and SetUnitY in the background.

Because all movements in wc3 is based on the X and Y
04-14-2006, 07:34 PM#7
emjlr3
its a native actually
04-14-2006, 07:47 PM#8
Captain Griffen
SetUnitX and SetUnitY are faster, but don't have any checks in them. Going outside the map bounds will cause a crash, and they ignore terrain/blockers.
04-14-2006, 11:58 PM#9
MaD[Lion]
ye, since SetUnitX and Y don't do those checks, they are therefore faster to run, and if you run them with alot of units thay wont lag, as if u use SetUnitPosition for like 15 units at a time, it will lag