Input touch begin (OnInputTouchBegin()) doesn’t work properly in 4.18.2.
I’m testing it in the Editor (not on a mobile).
In Blueprint it doesn’t work. No click is handled.
As for C++:
I spawn a few ACharacters and make them move.
In each of them I call OnInputTouchBegin.AddDynamic() which invokes a handler method only after I click on a ACharacter a few times (and the ACharacter moved a bit).
It used to work correctly in 4.17.1. Every click was handled straight away both in C++ and Blueprint. I switched from 4.17.1 to 4.18.2, therefore I don’t know if it applies to the versions inbetween.
Hello Wojtt, when you attempt to set this up in Blueprint, how are you doing it? I was able to get this to work in 4.17 and 4.18 by doing the following:
Created a new Blueprint Top Down Template project
Enabled “Use Mouse for Touch” in the Project Settings
Clicked on one of the cubes in the level and turned it into a blueprint
Added the following nodes to the blueprint:
After doing this, clicking on the cube I made into a blueprint causes the string to be printed each time. Please let me know if you’re doing anything different.
Thank you for your response and for taking the time to investigate and reproduce the issue!
There are two issues I’m addressing:
As for the way I set up the OnInputTouchBegin in BP, you can see that Blueprint part in BP.png file - this is a part of the Level Blueprint. In this level there is only one SpiderCharacter.
I was investigating that for a while and it turned out that enlarging CapsuleComponent size helped and now the click is handled in BP.
You can see the different CapsuleComponent sizes in the SpiderCapsuleComponentSizes.png image.
The strange thing (at least to me) is that in 4.17 the smaller CapsuleComponent size worked perfectly fine, while in 4.18 it doesn’t work at all, so I had to make the CapsuleComponent bigger.
There is also another issue I’m having with the SpiderCharacter, this time it is all set up in C++, I mean both the Character setup and the OnInputTouchBegin event handling.
In this level I have 3 spiders walking and the OnInputTouchBegin event is handled only from time to time - sometimes I have to wait until the spiders moves a bit so the event can be handled. In 4.17 the OnInputTouchBegin event was handled with every click.
I’ve alredy enlarged the CapsuleComponent (see SpiderCapsuleComponentCpp.png) but the problem persists.
It seems that in 4.17 OnInputTouchBegin was triggered when any part of the CapsuleComponent was clicked, but in 4.18 only certain part of CapsuleComponent gets that event.
Therefore, when a Character is positioned in different part of the screen the user needs to click different part of the Character (or the CapsuleComponent to be precise) for the OnInputTouchBegin to work.
I have the same issue. The box collision does not line-up with the where the actual collision is, though I presume that it’s the trace for the touch doesn’t line up under the cursor (I’m testing this on PC using mouse for touch).
For example I created an empty blueprint level from the Blank template, turned the vase into a BluePrint, added a box collision to the vase,scaled it up around the vase ( i have (X=6.0,Y=6.0,Z=6.0)), make it visible in game, with the collision box selected, in Details/Events select On Input Touch End and in the blueprint that it brings up just have it do a Print String ‘Touched’ .
Now when you play if you click the collision box nothing happens but if you click to the right of the collision box the touch event is triggered . I can upload my project if it helps
rOb
From my testing the reason why scaling it up helps is because more of the collision sphere is over the spider. From my testing the collision is not centered where it should be , but I presume that it’s not the collision that is wrong but the actual trace from the cursor into the screen. I’ve added a comment below
rOb
OK, this is definitely down to the trace from the touch to world space. This problem only happens the you play in the Selected Viewport. If you play in a separate window ( running in it’s own process ) like Mobile Preview ES2 everything works as expected so you can use this as a workaround until the bug is fixed
Hope this helps.
rOb
Unfortunately, assisting with and diagnosing this issue is difficult without being able to reproduce it. Would it be possible for you to provide a sample project with this behavior? If you would rather share it privately, you can send me a private message with a link to the project on the forums.
Thank you for your input
I followed your suggestions and I think you might be right about that this is a touch trace problem and it doesn’t occur when playing Mobile Preview ES2. Hopefully the bug is fixed soon.
Thanks again
You are right! I did have the Windows Scaling enabled and after disabling it everything is working fine!
It seems that 4.18 version takes the windows scaling into consideration also when it comes to the editor layout as the editor windows are also affected.
I tested using your project but I’m still not seeing any issues related to trying to click on the capsule component. The only edit I made was to turn off “Hidden in game” for the capsule so it would be visible while testing and then recorded this video
From what you told me, the animation would play when you clicked to the right of the capsule, instead of on it. This actually may be due to Windows Scaling or High DPI settings if you’re using any of those. Can you try disabling those to see if they’re why this is happening? It could be offsetting the touch location.