I’m having a problem rotating reels on a slot machine game.
I thought it was iTween, so I tried transform.Rotate, but it still does the same thing. Instead of the reel rotating around its own axis, it’s rotating around some other weird axis, as show in the pics below.
In the code below I’ve turned off the rotate on the first two reels to isolate the problem.
Is there some setting I’ve missed or something wrong with the code? When I click on the reel, the axes show they are dead center of the reel. I can’t figure out why the reels are rotating around some other axis instead of rotating around its center.
thanks!
var re1 = GameObject.FindWithTag("reel1");
var re2 = GameObject.FindWithTag("reel2");
var re3 = GameObject.FindWithTag("reel3");
while(z>0){
if(z>5){
//iTween.rotateBy(re3,{"x":5, "delay":0.1});
re3.transform.Rotate(Vector3.right*5, Space.Self);
z -=5;
}
else{
//iTween.rotateBy(re3,{"x":z, "delay":0.1});
re3.transform.Rotate(Vector3.right*z, Space.Self);
z = 0;
}
}
if(y>0){
if(y>5){
//iTween.rotateBy(re2,{"x":5, "delay":0.1});
y -=5;
}
else{
//iTween.rotateBy(re2,{"x":y, "delay":0.1});
y = 0;
}
}
if(x>0){
if(x>5){
//iTween.rotateBy(re1,{"x":5, "delay":0.1});
x -=5;
}
else{
//iTween.rotateBy(re1,{"x":x, "delay":0.1});
x = 0;
}
}