Problem Getting Touch Location

The problem that I ran into is trying to detect when the player touches the screen if its over an actor of a certain type example npc or enemies and target said actor. I have a general idea of what to do, but I am stumped on what nodes to use. I know that I need to get the touch location of the screen then run a line cast or some form of collision test to see if it collides with an actor. Any help would be appreciated.

You don’t even need to do a line trace. Just use a Get Hit Result Under Finger by Channel node. Then you can compare the hit actor with the types of actors you want to look out for (In your example it would be npc or enemies).

I tried using that node but for some reason it wont show up in the character blueprint it only shows up in controller blueprints. When i get off today ill look at it some more thanks for your help.

If you want to call that node in your character, then you need to get that character’s controller first.

So we have a german trying to sell male enhancements unless google translate is extremely off.

Ah ok thanks.

Sorted. Not sure how that individual got past the moderation queue. 8-{

Yea i know thats why i mentioned it.

Thanks for that. Next time just use the “Report Post” option and all the moderators will get notified and deal with it. 8-}


Hopefully my screen shot showed up like it should, but that is what I have so far and its not doing a darn thing. Figured I would upload it to see if I am missing anything. NumHits is just an int that should +1 every time I tap on an actor type of testbaddy. Just trying to get that simple bit before I move onto finishing the targeting system.

2 Likes

Am I just missing something or is everyone just as stumped as i am?

If you just get the actual actor output and do a print string from it what does it show?

Does your “Input Touch” get called? Where are you testing this, in the Editor? Have you enabled simulating
Touch events with MouseClicks in the ProjectSettings->Inputs?

I’m using these exact nodes and it is working on my end. You also may want to disconnect the “Released” event
or the “Pressed”. At least one of them. Because otherwise you do 2 klicks per touch.

Let me look in the settings, and yes I am testing this in the editor. As for the string no that’s what my num of hits integer is for.

eXi did you place the nodes in the controller or character blue print?

In my Controller.

I moved the nodes into the player controller itself and is now breaking at the break points not sure why touch event wasnt even firing. So updated problem when i clicked on my test baddy it just passes through and hits the floor.

I’m tracing for Objects, not for channels:

I guess the thing you trace has the “Visibility” channel you are tracing set to ignore or overlap.
You need it to block!

I think your way makes more sense let me try that instead.

It works when using objects under finger. Thanks for your assistance.