Need help with my swipe controlls.

I want my character to jump while walking instead of stopping for a split second before jumping. I want it to be all one fluid motion. Im pretty sure this is because my swipe controls reset when touching the screen again.



I don’t know much about touch controls, but I guess I’ll try to help since you are so in need that you have started posting in other random threads.

What does the player do to make the character jump? Tap the screen?

So the character jumps when I swipe up. So if the touch start minus the touch end is less than -50 my character jumps.

my main problem is that my character stops moving before jumping

Okay, so the player swipes up, and if their finger has left the screen for less than a certain amount of time, the character jumps?

ok so I have two vectors. Start and end. I determine which way the player swipes by subtracting these two vectors and also by looking at the x and y values. So its not time but its about looking at the coordinates of the start and touch to determine direction.

So if I swipe up the y value will be negative therefore resulting in a jump. Since touchstart minus touchend will always be negative.

And a “swipe” sometimes consists of lifting the finger off of the device, so you suspect that when their finger comes back down again, it is doing something with the input? Or is it the lifting of the finger in the first place that causes the stop in movement?

Could you just plug this same functionality as jump into the move forward input as well? I assume jump will take precedence over move forward if the same exact action causes both.

yes i believe its when I touch the screen again and also for some reason when I chnged jump to a tap instead of a swipe it worked. I did this by changing the greater than -50 to a greather than 0.

could u elaborate on the second part?

I don’t know much about how touch inputs work, but with keyboard and gamepad inputs, you can uncheck the “consume input” option in the details panel to make an input do more than one thing.

So, if, for example, we were using keyboard input and I wanted the character to both move forward and jump at the same time, I could make spacebar both move the character forward and make the character jump (and jump would take priority so it would do that).

In your case, it seems like there is a slight delay on the jump when the player touches the screen and the character stops moving. So, for the duration of that slight delay, they could be moving forward for a moment (at least if it was keyboard inputs).

Anyway, that is my attempt to help. I’ve been on the forum too long now, and I genuinely do not know anything about touch inputs. I’m sorry there aren’t more people browsing the forum that are knowledgeable in this area.

Good luck. :slight_smile:

This spaghetti is pretty unreadable :frowning:
I would recommend that you start by learning how to write readable code, it will make it much easier for you to find issues.

Have you tried enhanced input in UE5.1?

hi,
here is a little example… i simulated the swipe here ( my ordered phone did not come till now, my wifes phone is somewhere and she is asleep; unreal won´t run on my trusty old nexus 5 :frowning: )

ok this is what it does, you can see my mouse cursor swipe ^^

mouse simulate touch

the touch input

i used the standard third person character and made some modifications :slight_smile:


this checks the swipe distance (macro)

hope this helps you :slight_smile:

tomorrow after work i can make it on a real phone :smiley:

cheers :vulcan_salute:

1 Like