Thumbstick to rotation

Hi,

I’m making a 2D game and i want my character to shoot in the direction of the right thumbstick.
But i can’t figure out how to get the direction and set it as the rotation.

i tried to make a vector out of horizontal and vertical joystick movement combined and then convert this to rotation, but this didn’t work. At the moment it fires in the direction of the player and i’m using a make transform node to set the direction

HI There,

I don’t have a gamepad with me right now so I can’t test it, but I’m pretty sure this will work.

Since the laser’s yaw is already being driven by the direction your character is facing, you’re really only looking to influence the pitch of the laser, via your right stick’s vertical axis value. In that case, you could try something like this:

Note:
Since the axis value of a joystick is between -1 and 1, you’ll want to multiply that by 90 to convert it into a pitch rotation between -90 and 90.

If you want the right stick to also change the direction your character is facing while firing, that’s a different set of logic, but I can help you with that too if that’s what you’re looking for.

it worked!
thanks for the help.