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!
asked May 28 '14 at 05:58 PM in Blueprint Scripting
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.
answered May 28 '14 at 06:51 PM
this post resolve all my problems, just use "get viewport scale"
answered Mar 13 '19 at 09:23 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here