Tweening produces inaccurate results


  • *
  • Posts: 1259
In working on the Cutscene pack, I'm trying to use the Actor tweening blocks -- specifically the Spin To and Spin By.  I think these would be great for cutscenes -- for many things. 

The problem is that when I tell the Actor to spin by 360 degrees over 1 second, the results are always different.  Sometimes it goes 355 degrees, and other times it goes 358 degrees. 

My guess is that it's probably a timing issue between the tweening engine and the stencyl side -- unfortunately I have no idea where to go from there.  Anyone have any ideas on how we could fix this?


  • Posts: 1118
I put this in a post on the Cutscene pack, but I'll post here too:

I don't know how the Tweening block actually works engine side, but could it be an issue with Floating point numbers not rounding out to a whole number when completed? Having decimals not add up to what they should equal could cause the angle to be off by varying amounts.

When I was working on my Top-Down Shooter Kit that I never finished, and even some volume controls in a game, I noticed that the Floating point values were not adding up properly. But that is a problem with computers, not necessarily Java or AS3. This is the only idea I can think of that would cause something like this to happen.
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs


  • *
  • Posts: 17533
There may be a small discrepancy where timing doesn't sync up with step durations. A workaround is to use an idiom of:

do later
   set to final value

To dig in further, you'll need to look at the 3rd party Tweener code and see if you can tie it to our fixed step system.

plaf/flash/caurina/caurina/transitions/ is the place to look and the functions you're using are inside