2d rotation is not working at all (Solved)

Hello,

I am going to explain my trouble. You will see, I am programming for PSVita (not PSM) and I am making a top view 2d game. My idea is to move my character using the left stick and rotate it using the right one. The traslation is working very well but the rotation is not.

I have tried many ways, every one described in the next post and many others.

My initial code is the following:

MoveRotation(){
float X = Input.GetAxis(“Right Stick Horizontal”); // These give me values between -1 and 1
float Y = Input.GetAxis(“Right Stick Vertical”);
float angle = Mathf.Atan2(X,Y)*Mathf.Rad2Deg;
transform.rotation = Quaternion.Euler(new Vector(0,0,angle));
}

void Update(){
MoveRotation();
}

In my debbuging process, when I put debug.log(angle) and I see that the angle is changing when I move the stick but for some reason my character is not rotating. Up to now, I only got to rotate my character using the mouseposition.

Well, if someone can help me I would appreciate it.

Thanks in advance,

Rafa

P.D.: I am using the Unity Pro 5.1.2p2

Should the new vector be new Vector3 in your transform.rotation?

Ok, I am closing this post because my initial code is working, the trouble was that I had an aditional code in order to rotate the character using the mouse and this code, for any reason, makes a conflict with the other one. Once I comment it my original code started working.

Thanks, but this was not the trouble. The code shown here was an example with sintactic errors. Anyway, thank you for your fast replay.

My final working code is

void Move_rotation()
{
Vector3 dir = new Vector3(Input.GetAxis(“Right Stick Horizontal”),Input.GetAxis(“Right Stick Vertical”),0);
gameObject.transform.rotation = Quaternion.Euler(new Vector3(0,0,Mathf.Atan2(dir.y,dir.x) * Mathf.Rad2Deg - 90));
}