Make units spin

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
with SetUnitFacing and SetUnitFacingTimed, the facing of a unit can be changed. I assume that per call of this function we can at maximum rotate the unit 359 degrees. Is that correct?
Now, let#s say we do this with a timer, then the maximum angle speed that can be achieved should be < 360 / timer_frequency

let's say, I call a timer every 0.04 seconds, then a maximum of close to 25 rotations per second should be achievable. Yet the spin speed I get in game looks nowhere near 25 (rather looks like a 1-2 rotations/sec)

JASS:

function timer_child takes nothing returns nothing
//
call SetUnitFacing(u, GetUnitFacing(u)+359)
//
endfunction


Where's my mistake? Any ideas how to make units spin fast?
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
Perhaps the unit needs to have Rotation Speed set to 1 in Object Editor?
 

Arkan

Nobody rides for free
Reaction score
92
I tried rotating a unit with a timer callback aswell, to my dissapointment it didn't look good at all, more like he twisted 180 degrees at a time.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> phyrex1an

In other words SetUnitFacing(u, GetUnitFacing(u)+X), the closer X is to 180, the faster the unit will spin, the unit will spin the to the angle with the shortest route possible.
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
yeah, I already suspected it's 180deg

I'll see if it looks more like 12,5 rotations / sec with a timer callback time of 0.04 sec

EDIT: a few tests later, and the maximum I can get is about one rotation. Still very unsatisfying.

is there something I'm doing wrong?

JASS:
                    call SetUnitFacingTimed(.u, GetUnitFacing(.u)+.vf,move_interval)
//move_interval=0.04, .vf=180.0
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
> I'll see if it looks more like 12,5 rotations / sec with a timer callback time of 0.04 sec

You need to balance it. Making the angle change by too much every run will make it look choppy, but when making too many runs of timer it could lag a bit.
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
> I'll see if it looks more like 12,5 rotations / sec with a timer callback time of 0.04 sec

You need to balance it. Making the angle change by too much every run will make it look choppy, but when making too many runs of timer it could lag a bit.

I wish it would look choppy, then I'd know that it works out. Yet the spin looks smooth, but is a lot slower than I want it.
 

Rheias

New Helper (I got over 2000 posts)
Reaction score
232
Then decrease the interval, or increase the angle. Do some calculations, 12.5 every 0.4 seconds might be a bit slow.
 

Doomhammer

Bob Kotick - Gamers' corporate spoilsport No. 1
Reaction score
67
I'm trying to make them rotate as fast as possible (with a timer frequency of 0.04 that would be ~12,5 rotations per sec i.e. 4500 deg/sec)
yet I somewhat think that there is a native limit - the fastest I could make units spin was simply lame. Can anybody confirm this?
 

grim001

New Member
Reaction score
10
yes, there is a limit, no, there is no realistic way to bypass it.

what you can do is create and remove a bunch of identical new units, since new units can have their facing specified instantly. but this approach is kind of laggy.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top