Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only. On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live. Read our full announcement for more information and let us know if you have any questions.

Question Discrepancy in simple spinning animation using script.

Discussion in 'Animation' started by aks20997, Nov 21, 2023.

  1. aks20997


    Jul 31, 2023
    I am creating a roulette-type game in Unity for that I need to spin the roulette wheel and the ball and stop both of them at once.

    The problem I am facing is if the ball is supposed to stop at an angle of 240f then instead it stops on 241f.

    In order to fix this, I implemented this line of code,

    Code (CSharp):
    1. pivot.transform.localEulerAngles = new Vector3(0, 0, -thetaBall);
    But on running in Android, the ball appears to jump on that number.

    Is there any way I can make the animation smoother and make it refresh-rate-independent?

    I am not using physics, I am simply generating the angle randomly from the given array, and making the ball stop on the choosen angle and treating the index of the choosen angle as the winning number.