Player Arm will not rotate when moving with Xbox Joystick

Hello,

My problem is I can’t get my player’s arm to move when a weapon is selected. I’m using an Xbox One controller and have the inputs in Unity. I can move the arm with the mouse and have it face the position the mouse is pointing at but I can’t make it work with the controller.

My code to make the players arm move with mouse…

public void CanTurn()
    {
        Vector2 direction = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        transform.rotation = Quaternion.Slerp(transform.rotation, rotation, Speed * Time.deltaTime);
    }

I’ve looked at the API and many tutorials and and still nothing has worked. I thank anyone that stops by to look or helps.

Thank You.

Use the pad axis instead of the mouse position.

there is some example here