Announcement
Collapse
No announcement yet.
Make Rotator from stick for side scroll shoot
Collapse
X
-
Nawrot repliedLast 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/show...ghlight=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.
Leave a comment:
-
sugunwar repliedMaybe somebody can give a principial scheme for solve this problem?
Leave a comment:
-
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 https://answers.unrealengine.com/que...escroller.html and this https://forums.unrealengine.com/show...g-Shooter-Help
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.
2. Move, jump blueprint
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.
Maybe I choose wrong way? Maybe need solve Aim for touch with different nodes and information?
Please help.Tags: None
Leave a comment: