Hey all,
I have a ring with 12 equally-spaced symbols that the player will spin with their finger. Once the “touch” is released, the ring must auto-correct to the angle on which the closest symbol is located - the marker/indicator is located at top-centre of screen. I’m using Transition.to() to auto-correct the ring.
Everything is working great except the direction of the rotation seems to be somewhat random. For example, if the closest symbol is located to the left of the marker/indicator, some times the ring will slowly rotate to the right (perfect!!). But other times, under the same scenario, the damn thing will spin ~360 deg to the left - it still goes to the correct symbol but takes the long route and looks ugly.
I’ve done a bunch of testing and it seems like it only happens when I change the swipe direction AND cross the 0/360 degree angle. I’m at a loss as to why this is happening tho.
Here’s the code that’s moving the ring:
--Move ring position of nearest symbol spinnerAngle = spinner.rotation % 360 local moveToAngle = NearestValue(anglesOfSymbols, spinnerAngle) if (moveToAngle == 360) then moveToAngle = 0 end transition.to( spinner, {rotation = moveToAngle} )
Note, my rotations are being normalized/modded to 360.
Any ideas?
Thanks.