Little help please! :)

Hi guys. I have a sidescroller character setup in my game. I can control the movement and aim with the left controller stick. Example here:

So aimoffset is controlled by the sticks up and down value. Now when I try to play this on my phone, something strange happens:

if I touch anywhere on the screen while aiming with the stick, the aim of my character would snap to default angle for a moment and then back to where I want him to aim.

So it seems like touching the screen is messing with the touchstick value for some reason. Here you can see how the aim of the guy snaps to default when I am tapping the screen at any location:

Please advise how to fix this :slight_smile:

Hi Pabooklas,

How do you have your axis rotation set up? It looks like you have something that resets the value back to its original position after you hit a certain angle. Can you show me a screenshot of how your rotation is set up?

Hi. I will try to explain because I am not near my pc atm.
My aim offset is -90 to 90. On character bp I take the Y axis value of the touchstick(which is -1 to 1) and multiply it by 90. Then the result is used to drive the aimoffset.

It is working like a charm on pc and even on my phone. But once I try to shoot with a UMG button or even if I touch an empty space on my screen, it snaps like you can see on the bottom video. It doesn’t snap at certain angle like you said, it snaps to default value everytime I touch the screen anywhere other than the stick.

I dont have anything else setup that would mess with the axis value in any way. There is nothing setup when I touch the screen itself either. The button just triggers a custom event to spawn a bullet. Ty for your time helping me!

Can it be a problem with multitouch? Like maybe touching the screen disables the stick for a few frames? Idk just thinking :slight_smile:

Is the UMG button tied to the touch input pad or is it tied to a simple touch event?

Simple touch event. I am heading home soon so I can post some screens.

I will also print the touchstick axis value on my screen and try to see if the value changes from me touching the button or empty screen space. If the value won’t drop to 0 then it is something else.

Ok so I threw a print string on my axis value* 90 result and I can confirm that on my phone every time I touch the screen anywhere else than the stick, the sticks axis value snaps to 0 for one frame and then back to the actual value. Here you can see me tapping the screen nonstop, check the print string:


Axis setup on character BP: AxisInput.PNG

Event graph on animBP: AnimBp event graph.PNG.jpg

AnimGraph: AnimGraph (1).PNG.jpg

Widget button: 8f1fd21b1ed7c1728e6d1df929126b682ee5928a.png

Any news on this mister Adam? I am still unable to find the cause of this problem.

It looks like you need to save your pitch value as a variable then add your axis value x 90 to it. Currently it is just using axis value x 90, so every time you touch the screen it zeroes out the value for a moment, forcing your character to reset. Try adding in a “get pitch” and a “float + float” node and see if that helps.

I had the same problem with clicking the left mouse button interfering with the rotation my setuo is exactly like that of the example in the first post how exactly does the touch event and mouse click event interfere? since keybord keys don’t mess up the system only mouse buttons do

I will try to do the float+float like you said after work. Thanks

No luck. Touch still resets my char for a moment. Stick axis goes down to 0 on touch and no matter how I do the math, I still need to have the axis value in there and on touch it snaps to zero…

Any other ideas how to work around this problem? a_najafi what did you do to fix it, or did you just gave up? :slight_smile:

Any other ideas how to work around this problem? a_najafi what did you do to fix it, or did you just gave up? :slight_smile: