Rotation Problem

Hey there, I’m having a bit of an issue trying to get this to work. What I want this game object to do is rotate in 90 degree increments along the x axis in one direction or the other. The only problem is that this particular part of iTween that I’m using is inexact for some reason, it comes out in weird decimals (which is undesirable, even though it looks about spot on). Also, I’d like to fix a bug where if you hit the opposite key to turn the other direction before the itween rotation is done, it will turn and stop halfway in between the increments. Are there any other ways of doing this, preferably within iTween?

Here’s the code I have attached to the game object:

var rotateTime = 1;

function Update(){
	if (Input.GetAxisRaw("Horizontal") > 0.9){
		iTween.RotateAdd(gameObject, {"x": -90, "time":rotateTime, "transition":"easeInOutQuad"});
	}
	else if (Input.GetAxisRaw("Horizontal") < -0.9){
		iTween.RotateAdd(gameObject, {"x": 90, "time":rotateTime, "transition":"easeInOutQuad"});
	}
}

alright, I finally figured out how to correct the strange turning and halt turning before a turn is done. Here’s my code for anyone else having the same problem, though it’s a bit convoluted and I’m sure there’s a better/simpler way to do it:

var cam : GameObject;
var menuType: int;
var myType : int;
var rotateTime = 0.3;

//Rotator Vars
var turnR = false;
var turnL = false;
var turnTimes : int = 0;

function Start(){
	cam = GameObject.Find("Main Camera");
}

function Update(){
	menuType = cam.GetComponent(mainMenu).menuState;
	
	if (turnTimes <= -4 && !turnR && !turnL){
		transform.eulerAngles = Vector3(0,0,0);
		turnTimes = 0;
	}
	if (turnTimes >= 4 && !turnR && !turnL){
		transform.eulerAngles = Vector3(0,0,0);
		turnTimes = 0;
	}
	
	if (menuType == myType){
		//call functions according to myType
		if (myType == 1 && turnTimes > -4 && turnTimes < 4){
			Rotator();
		}
	}
}

function Rotator(){
	if (Input.GetAxisRaw("Horizontal") > 0.9 && !turnL && !turnR){
		turnR = true;
		turnTimes ++;
		iTween.RotateAdd(gameObject, {"x": -90, "time":rotateTime, "transition":"easeInOutQuad"});
		yield WaitForSeconds(rotateTime);
		turnR = false;
	}
	else if (Input.GetAxisRaw("Horizontal") < -0.9 && !turnR && !turnL){
		turnL = true;
		turnTimes --;
		iTween.RotateAdd(gameObject, {"x": 90, "time":rotateTime, "transition":"easeInOutQuad"});
		yield WaitForSeconds(rotateTime);
		turnL = false;
	}
}