Setting Collision Eliminate Touch Input

I found a really weird bug in UE. I’m targeting mobile platform. The steps to replicate is this:

  1. Create an actor blueprint derived from Actor class.
  2. Add a static mesh component and attach it to the root component.
  3. Assign a static mesh to that component.
  4. Add OnInputTouchBegin event to that mesh component. Do a simple print string on that event.
  5. Change the Collision Presets to NoCollision.
  6. Put that actor blueprint somewhere in the level.
  7. Put a camera actor somewhere in that level too. But point that camera to that blueprint actor.
  8. In the level blueprint, make sure to view the game from that camera by using SetViewTargetWithBlend function after event BeginPlay.
  9. Play the game in PIE or Viewport.
  10. Try to “touch” or “click” that actor in the game.

You’ll see that it will not fire the OnInputTouchBegin event. But if you change the Collision Presets to BlockAll or BlockAllDynamic, then it can fire that event.

So what does collision have to do with OnInputTouchBegin event?

Hi Pelangi,

This is expected behavior. The Touch input technically runs a linetrace out to test and see what is under the cursor/finger location to test what is hit. To do so, it uses the collision channel. If there is no collision it cannot register the hit. If you need no collision on the object, the best way to achieve this is to run a trace from the finger location when you use the touch input. Have it test for visibility and run an interface function message when hit. If the actor selected has implemented that interface, it will react accordingly.