Controller Movement Problem

Hello,

I’m trying to get the complete movement on the left thumbstick of my xbox 360 controller. The ship rotates correctly to the angle of the thumbstick. It just doesn’t move in that same direction. For some weird reason, up=up, down=up. And many other weird things like that. There is also a problem with the rotation. When releasing the thumbstick, the player snaps back at the closes 90 degree angle (90, 180, 270, 360).

The code:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float movementSpeed = 5.0f;
    public float rotationSpeed = 5.0f;

    public float speed;

    void Start()
    {

    }


    void Update()
    {
        float x = Input.GetAxis("Horizontal");
        float y = Input.GetAxis("Vertical");
        float angle = Mathf.Atan2(x, y) * Mathf.Rad2Deg;

        
        //Thumbstick is being used
        if (x != 0.0 || y != 0.0)
        {
            transform.Translate(x * Time.deltaTime * movementSpeed, 0, y * Time.deltaTime * movementSpeed);
            transform.rotation = Quaternion.Euler(new Vector3(0, angle, 0));
        } else //thumbstick is not being used so do not change the angle back.
        {
            return;
        }

        
       
    }

}

I have fixed the movement problem. I had to use transform.position instead of transform.Translate. Still have the snapping to a 90degree angle problem though.