Using this code I was able to tilt it to the left - always to the left, even if I tilt thumb-stick moving to the right. And it’s not returns to initial position - it gets stuck at several degrees to the left.
float translation;
public GameObject leftThumbstick;
// Use this for initialization
void Start () {
}
void Update () {
translation= Input.GetAxis ("XAxis");
leftThumbstick.transform.eulerAngles = new Vector3 (0, 0, translation * 10);
}
I was mistaken about axis name (I used another in Input Manager).
But anyway still not working.
When I push thumbstick to the left it says:
-0.9961242
And it doesn’t give new values after another pushes.
Also it gives this value and object tilts object to the left even if I push buttons on gamepad.
I added Debug.Log(leftThumbstick.transform.eulerAngles) in the ‘if() {}’ - see values on screenshot (I turn joypad to the left and then to the right). Also I noticed ‘Bake paused in play mode’ message at right bottom corner.