Search Unity

iTween rotation rounding errors

Discussion in 'Scripting' started by RickP, May 28, 2010.

  1. RickP

    RickP

    Joined:
    Apr 4, 2010
    Posts:
    262
    So I need my object to rotate by 60 degrees. I can't understand why iTween choose to make the value 1 = 360 degrees, but that's the way it seems to work. So what I did was 1/6 so it'll rotate 60 degree. The problem is if I rotate it enough it starts to not be a perfect 60 degree rotation.

    Does anyone have any suggestions as to how to fix this. My suggestion would be to allow us to actually pass in the actual degree to iTween, but how about a faster solution :)
     
  2. pixelplacement1

    pixelplacement1

    Joined:
    Aug 19, 2009
    Posts:
    674
    Actually iTween has three solutions for working with rotations which will help you with this.

    iTween.rotateBy() - the one you seem to be referring to will rotate an object based on a multiplier of 360 degrees. For example you can rotate an object by 90 degrees by giving it .25

    iTween.rotateAdd() - Will add the supplied degrees to the current rotation.

    iTween.rotateTo() - will rotate the object to the exact degrees you supply. For instance you can tell it to rotate something to 60 degrees just like you were asking.

    There may be some slight mathmatical issues with the current versions of iTween but they are all getting solved and reworked for the release of 2.0.
     
  3. CoCoNutti

    CoCoNutti

    Joined:
    Nov 30, 2009
    Posts:
    513
    It's 2014 and this is still an issue. When's the fix?

    Thanks