For my roulette game, I want to rotate ball around centre with higher speed then slowly decrease its speed to 0. At start position for example ball start with speed 100 then at stop position its speed be 0.
I have written following code as per my understanding but going some what wrong in that even rotation cant seem correct one.
IEnumerator doSpin (float time, float maxAngle)
{
float timer = 0.0f;
float startAngle = transform.eulerAngles.z;
while (timer < time) {
float angle = ac.Evaluate (timer / time) * maxAngle;
transform.localRotation = Quaternion.Euler (new Vector3 (0f, 0f, angle + startAngle));
timer += Time.deltaTime;
yield return new WaitForSeconds(0.000001f);
}
transform.localRotation = Quaternion.Euler (new Vector3 (0f, 0f, maxAngle + startAngle));
wheelController.BallStopAtNumber ();
}
Using above code ball is moving with same speed, I want changes in speed as per my above description.
Please some one give me suggestion over here. I am available to reply you anytime if you not understand my question.