x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to compare touch input with button location

I was doing some reading on here and saw it mentioned that at the moment touch input buttons using box colliders from blue print do not currently receive input and that a way around this is checking the touch input's location with the location and size of the button you are trying to touch. In the provided image, I created a function where I am comparing the input position against the position of the button and taking into account the size for the button and then if the touch's x and y inputs and within the button's area, return true.

Does anyone have a better way of doing this or see if I am doing something wrong? Thanks!

alt text

Product Version: Not Selected
Tags:
more ▼

asked May 28 '14 at 05:58 PM in Blueprint Scripting

avatar image

9thKnight
28 4 6 6

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Here we go. I wasn't accounting for the function coming back false and also where I was drawing my buttons, I was checking the values of the buttons before they had been fully computed.

By passing in the position of your buttons and then the size of the button from a touch input, you should be able to check the outgoing bool to see if the touch is inside of the button area. I also have just a bool called Down in But that I am setting for if the user touches and drags into a button or touches a button and drags out of it.

alt text

alt text

more ▼

answered May 28 '14 at 06:51 PM

avatar image

9thKnight
28 4 6 6

avatar image JonathanADaley Jun 04 '14 at 06:52 PM

Your Check Input function worked beautifully to help solve an issue I was having with touch input and the HUD. I also added an interface to this setup that allows my HUD BP to report button locations and sizes to the player controller. Those two things coupled together make it so that you can make usable touch UI. Thanks for posting this!

avatar image 9thKnight Jun 04 '14 at 07:22 PM

Glad it helped

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
more ▼

answered Mar 13 '19 at 09:23 PM

avatar image

needforgrib
26 2 3 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question