hi all, I am trying to make a fruit machine, i have 3 cylinders, I have made an animation that rotates the cylinders 360 degrees on the x axis over 1:00 in the animation editor (sample rate 60).
currently all the cylinders have the same animation to test.
what I am doing is having a button that you press that then enables the animator to spin the cylinders this is my script :
#pragma strict
private var ray : Ray;
private var rayCastHit : RaycastHit;
var mySound: AudioClip;
var reel_1 : GameObject;
var reel_2 : GameObject;
var reel_3 : GameObject;
var rotateSpeed = 5;
function OnMouseUp () {
//play sound
audio.clip = mySound;
audio.Play();
StartCoroutine("Spin");
}
function Spin(){
reel_1.GetComponent(Animator).enabled = true;
reel_2.GetComponent(Animator).enabled = true;
reel_3.GetComponent(Animator).enabled = true;
yield WaitForSeconds(1);
//stop sound
audio.Stop();
reel_1.GetComponent(Animator).enabled = false;
reel_2.GetComponent(Animator).enabled = false;
reel_3.GetComponent(Animator).enabled = false;
}
when I press my spin button the reels spin fine, the problem I am having is that when they come to a stop, on each press they seem to stop at a slightly different position.
I want them to always stop in the same place (like on a slot machine).
Anyone see what I am doing wrong?
cheers