Line trace not hitting mesh component

Hi,
So I’m trying to make a system where when the player gets near a particular object, it will trigger a bunch of line traces to make sure the player is looking at it and then it should display a widget on the screen telling the player they can interact with it. However, when the player is looking at the static mesh component, the trace doesn’t detect anything. Any help would be greatly appreciated!


1 Like

First I assume the debug line is showing where it should be.
Then is it hitting anything or going through.
If it is hitting something I would do a print string to see what Hit Actor and Component both say.
If it isn’t hitting anything I would check the Actor and Component have relevant Blocking collision on the Visibility channel.
I don’t know what the Static Mesh variable is.
Lastly, sometimes == doesn’t work the way I expect and I need to Get Class and compare that instead. Not sure for components.

1 Like

Go to static mesh, under collision, and make sure “Generate overlap events” is ticked. Then make sure Collision Presets -> Visibility channel is set to overlap, and not ignore.

But why would you do it on this way? Check out this video, it can be much more simple: Unreal Engine Interaction System Tutorial - YouTube

1 Like

Hey @Bojann!
Thanks for the response. I’m definitely going to implement the interface as shown in the video. I wanted to use the line trace because it’s a first-person game and I wanted to make sure the player was actually looking at the interactable.

Also these are my collision presets. It still isn’t detecting anything from the actor.

Did you figure out this issue?

@Xayvair Yeah I actually just figured it out a few days ago. It’s a whole interface system that I called “BPI_Interactable” that just checks a bunch of things like if the object has been picked up/used before or if there needs to be a condition to be met before interacting with it like the power must be turned on before pressing a button. But I think the most important thing that I did to get it to work and correctly identify and check what it is hitting is getting the object name. Finally, in the details panel of the static mesh, I set the collision preset to “Default”.

1 Like

Ohh! this is awesome. I am actually using a similar interacable system. Everything was working fine but now static meshes are not being recognized. Skeletal meshes on the other hand work fine. (chest) but this is a smart way to go about it. Thanks for response!

1 Like