Desperetly need help with rotating an object to face the direction of the joystick

I really need help on making the object rotate to the position of the joystick. How would I do that?

What have you tried?

Is it 2D or 3D?

Pretty much anywhere in the "Project" tab.

1 Answer

1

Getting the z axis and setting a quaternion: Quaternion rotation = Quaternion.Euler(0, Input.GetAxis("Joy Z Axis"), 0);

Setting the rotation to the quaternion: transform.rotation = rotation;

And to add the Z Axis Input:

How would i go about makeing the joy Z axis

Its not working, Im not sure why.

[115491-screenshot-6.png|115491] So this is how it works. I want that cylinder to point in the exact direction of the joystick, and i just dont know how.

oh, didnt know that, I'm realy new at this, thanks , I try it but didnt work