I just want to send out a sphere trace when I click the mouse button so that I can open a door. It doesn’t work. When I chose a key instead, it works, but not a mouse click. What is up with that?
I’m using the Top Down Character template btw.
Show bp please if possible
Here’s a short video I just made showing what’s going on:
Did you make any changes to the 3 variables under Edit->Project Settings->Engine->Input->Viewport Properties?
Just to be sure, this problem isn’t related to Traces, is it? The event is simply not called?
Yeah, no problem with the trace. It works if I use a key, but not a mouse click. I didn’t change those variables. Here’s a screenshot.
You are also clicking to move around, correct? Maybe that is absorbing the click before the trace attempt?
You know, it’s actually not working with anything except when I call a mouse click to interact with another BP. I just tried calling a simple string on mouse click and that won’t work either.
Maybe you could use an invisible UMG canvas overlay so you can check for clicks anywhere? Now that you mention it I feel like I have had a similar problem before.
True, but what about right click? It doesn’t work either. Could it have something to do with the character being controlled by a AI controller?
Can’t you call the event that sends the trace from the event that is handling your character movement after click?
Under the Top Down Controller, there are “click event keys” under the class defaults > mouse interface. It appears that perhaps all mouse clicks are tied to the movement system and all mouse clicks are somehow bound to do the same thing. So maybe it is absorbing the click before it gets a chance to trace.
Okay, figured out. Apparently, it has nothing to do with anything, other than the fact that the code for the trace by click must be done in the player controller’s event graph.
Nope! Been playing around with it all day and realized the reason this is happening is because I was trying to get two different events to take place on the same input command. Unreal doesn’t like that. So anything that happens on mouse click had to be a part of the same event.