# Rotating an object - problem with angle.

Ok, I am new to coding... I made this own variation of code out of some examples and it works basically as planned = I can turn a model 120 degrees by left/right arrows (horizontally). I can also turn/tilt the model vertically but now it rotates weirdly (up/down). At "0 degrees" = not rotating the object sideways (horizontal), the vertical rotation works fine, but when I look at the model from a 120 degree angle, the up/down rotation bends sideways.

``````private var rotate : float = 0.0;      // rotate horizontal
private var rotateto : float = 0.0;    // rotate horizontal
private var easinout : float = 0.05;
private var rotatev : float = 0.0;     // rotate vertical
private var rotatetov : float = 0.0;   // rotate vertical
var Target : GameObject;

function Update()
{
rotate = rotate + (rotateto - rotate) * easinout;
Target.transform.rotation = Quaternion.identity;

// rotate vertical (up down)
rotatev = rotatev + (rotatetov - rotatev) * easinout;
Target.transform.rotation = Quaternion.identity;
Target.transform.Rotate(rotatev, rotate, 0);

if (Input.GetKeyDown("left"))
{
rotateto += 120.0;
}

if (Input.GetKeyDown("right"))
{
rotateto -= 120.0;
}

if (Input.GetKeyDown("up"))
{
rotatetov += 20;
}

if (Input.GetKeyDown("down"))
{
rotatetov -= 20;
}
}

``````

turn off mouselook...or at least limit the constraints of your x, y, or z values.

Ok problem seems to be the object rotaes around its own axis, and not world axis. How can I get it to rotate around world axis? Adding Space.World to the end of Target.transform.Rotate(rotatev, rotate, 0, Space.World); doesnt help...