How do I make custom Input Touch events?

Does anyone have any resources that give some hints at how to develop custom touch events for android and ios platforms?

If youre wanting to add GUI widgets like the thumb sticks, Make a new Touch Interface Setup, and open it up.

Click the + next to “Controls” to add a new input control. You can assign all the settings / images for it there.

Under “Main Input Key”, you can assign it to an input that Blueprints recognizes

Once it’s done there, Head over to “Project Settings”, and hit “Input” on the left toolbar. In the " Mobile" section, assign your Touch Interface Setup to the “Default Touch Interface” section.

Also - It’s a good idea to play in the mobile sim on computer before pushing to device to ensure functionality. Just to save you possible future headaches :slight_smile:

Hey iveytron,

Thanks! I am a little fussy on some things. I hope you don’t mind clarifying.

So, I went through all the steps but when I get to the project settings, my interface doesn’t show up. Any reason this would be a problem?

Also, I guess I am not getting it but how would I create my own input functionality. If we already choose the input, how do we control it. So lets say we want to record the current position of the finger, then capture the difference between his/her initial touch location and the new, then add movement to the character accordingly? So far it looks as though there are swipe and touch inputs but nothing to control where, when, why and how they are used.

Thanks again for the help!

I found out why the interface was not showing up, I needed to create a new touch interface class under the misc. fly-out menu. The other question is still valid. How do I use this interface to add customized controller functionality based on touch?

I misread the original question, sorry. Let me update my answer.

To set up Touch Events, Go into the Blueprint that should receive the event, and right click to add a new “Touch” event.

3952-screen+shot+2014-04-12+at+7.46.32+pm.png

You can then do conditionals using the touch location and finger index to fire off events.

3953-screen+shot+2014-04-12+at+7.46.25+pm.png

Don’t I still need a custom touch interface if I am to use the touch event in the character controller?

PS: The mobile preview is crashing when I add a touch control in my custom interface. It’s runs if I remove the control index but there is not touch input registered. Why the crash?

Why no input? Besides the touch interface crash, shouldn’t something be happening here?

Any help would be appreciated.

Thanks!

I believe it is crashing due to you not having an image assigned. At least, that was my happening to me with my custom TouchInterfaceSetup.

Ok, so I got it logging the touch position on screen but when I hold the mouse left click down, it no longer tracks the mouse position (Using the mobile emulator). I can’t really do much with an event that only fires once. Is there no touch-and-hold access with updated position, size and velocity?

And if you created a button like I would match the command to fire? Can you help me?

And if you created a button like I would match the command to fire? Can you help me?

Hello jcdied4me,

I am sailing on the same boat. Have you solved this issue if yes please guide me how. to do it I am doing the similar task so it would be helpful. I appreciate your help!

Thanks a lot.

My touch scripting is being handled in the player controller which has access to input controls. The touch interface presented by iveytron is canned and unmodifyable to my uses.

Basically I used the touch event as shown above to set a bool variable named “is touching” to true when pressed and false when not pressed. Then I use a branch after a tick event to execute the custom touch script. I first capture the initial touch location variable. Then I begin updating the current location variable. I do a compare to see if current x is greater or less than the original touch x location. I also do some conversion math which limits the screen space of the finger drag and remap the resulting data to a range between negative 1 and positive 1, 0 being the original touch position. Then I feed this new data into the current velosity of the players pawn. I hope this made sense?