Rotate Ball with high speed rotation to slow speed (150407)

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.

Anybody has suggestion or example for this? Please give me some help.

–

2 Answers

2

Just a suggestion cant you use coroutins to slow down the speed

Lets give me one try for this. Reply back to you with some sort of result. Thanks for your quick reply.

–

Ok, your comment makes sense. A model with hundreds or more vertices is obviously better than a quad with 6 vertices (4 of them actually being the same two). But if not on mobile then those are...hold on nope... So yep, you're right and I won't argue.

–

I got my above question’s answer myself only. I writing here for other members usage because they definitely come across in same condition.

Basically I am using Animation Curve for rotation of ball. Then it is solution my question.
I change shape of Animation Curve to curve line from flat line. Following image gives you more idea about this.

Ori and The Blind Forrest? Never played it or dont realize it's a mix of 2D sprites and 3D models? No PC that can run a fps made post 2012 will ever have a problem running a platformer regardless how you build it with models/sprites. You're right a sprite is better for performance but absolutely wrong to argue that you should never use 3D models in a platformer because its somehow pointless.

–