Announcement

Collapse
No announcement yet.

Make Rotator from stick for side scroll shoot

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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.
    Click image for larger version

Name:	Char.JPG
Views:	1
Size:	29.8 KB
ID:	1144188

    2. Move, jump blueprint
    Click image for larger version

Name:	movejump_input.JPG
Views:	1
Size:	78.3 KB
ID:	1144189

    3. Fire=spawn projectile
    Click image for larger version

Name:	fire.JPG
Views:	1
Size:	77.1 KB
ID:	1144190

    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.
    Click image for larger version

Name:	gamepad.JPG
Views:	1
Size:	66.1 KB
ID:	1144191

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

    Please help.
    Character artist\Team lead https://www.artstation.com/sugun

    #2
    Maybe somebody can give a principial scheme for solve this problem?
    Character artist\Team lead https://www.artstation.com/sugun

    Comment


      #3
      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/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.

      Comment


        #4
        Thank you, here is workenable solution
        Click image for larger version

Name:	projectile.JPG
Views:	1
Size:	78.3 KB
ID:	1066525
        Character artist\Team lead https://www.artstation.com/sugun

        Comment

        Working...
        X