Game Development Community

rotateTo callback fails

by Aditya Kulkarni · in Torque Game Builder · 06/25/2010 (1:19 am) · 2 replies

If I have 30 or more objects, the callback starts to fail for 3-4 of them.

I basically want them to wobble so the user notices them easily. The code is simple, so I don't understand why it fails.

function wobbleIcon(%icon) {
   %icon = %icon.getName();
   if(isObject(%icon)) {
      if(%icon.rotDir==1) {
         %icon.rotateTo(25, 85, false, true);
         %icon.rotDir = 0;
      }
      else {
         %icon.rotateTo(-25, 85, false, true);
         %icon.rotDir = 1;
      }
   }
}

function upgradeIcon::onRotationTarget(%this) {
   wobbleIcon(%this);
   //schedule(0,0,wobbleIcon,%this);
}

#1
06/25/2010 (10:00 am)
Um, you should probably use that schedule, but give it 20-30 milliseconds to execute.

A schedule with 0 time is very unreliable.
#2
06/25/2010 (11:22 pm)
Tried that already, doesn't work. Got around this by using an animation instead.