Download

How to handle touch input in c++

When I bind action inputs I am able to choose between Pressed or Released events. How can I have the same behaviour with touch input? I’m coding in c++ and I was only able to find blueprint-related documentation. Right now all I can do is retrieve touch location and whether the screen is beign touched or not, which is great, but I need to save the location value when the touch begin for later use.

If you subclass the UGameViewportClient then you can intercept touches the moment they happen by overriding the InputTouch function. This would let you handle when a touch begins, moves and ends.

Here’s an example of that:

Ok, problem solved, you pointed me in the right direction :smiley:

I found APlayerController::InputTouch function but I didn’t realize it was the right one. So I override it in my player controller class and now everything works fine. Thanks!!



Cap3.PNG
Here Is My Setup