Make Rotator from stick for side scroll shoot

Hello, I very cearful check all previos threads and answerhub about side scroll aim. But actually can’t find any work solution.

Yep I know about this thread Shoot Projectile Up/Down (SideScroller) - World Creation - Unreal Engine Forums and this 2D Side-scrolling Shooter Help - Blueprint - Unreal Engine Forums
but can’t solve my problem with this information.

So I try find solution in this thread, please help me.

  1. Simple game char. With keyboard and gamepad inputs.
    6610b520aa628a280eadb37bd6d9f4cb49a4bc10.jpeg

  2. Move, jump blueprint
    b4bb94a29d740e9738aaa617d6172579e76d512a.jpeg

  3. Fire=spawn projectile

So how can get touch vector and convert to rotator for projectile?

I try to get some information from gamepad x\y but in string 0 only, it means gamepad disable.
7fe040878d3e74c84efb69bf3ff19c1c1e7e8c72.jpeg

Maybe I choose wrong way? Maybe need solve Aim for touch with different nodes and information?

Please help.

Maybe somebody can give a principial scheme for solve this problem?

Last picture has what you need. Plug X and Y instead of break 2d vector. So basically: sign(Asin(Y))*acos(X), or something like that, you need to experiment with printing out result. That will depend on your positive and negative values you gave to axis event.

Also one thing you should be aware of: if sign(asin(Y) is zero it will zero result of formula, so when exactly horizontal (or vertical) you will have wrong results. To remedy this when sign is 0 give it 1 or -1 instead.

https://forums.unrealengine.com/showthread.php?53157-Re-orienting-rotation-0-point&highlight=nawrot

Just experiment with this formula, each case needs a bit different angle. It is better to calculate it here the way its easiest to use in game, than tweak it to right values all over the code.

Ps. you an always make your pad into 3d vector (x,y,0), normalize it, and do dot product with for eg. (1,0,0). You will get kind of cosinus value or how parallel both vectors are. And you can do this same with (0,1,0) so you get values for horizontal and vertical. Then you can use those values to scale x and y velocity of projectile etc. I used this for my boid math, its faster in 3d, very nice to scale turn forces or forces for projectile etc.

You can also turn your vector into 3d, and use “look at direction” node from 3d vector math. To debug those vectors use “trace” for drawing vector feedback.

Thank you, here is workenable solution
217407185a74893a9c388f4c41877e5ef1d22476.jpeg