Forward trace is returning false positives?

Hi,

I’m a complete beginner when it comes to blueprints. I can’t code. I’m not a programmer. So forgive me if I mess up any terminology here.

I’m working on a tiny first person adventure game which only requires a simple interaction with a small variety of objects. I’ve set up a trigger box around the asset that displays a message in the viewport to press E to interact. I followed a couple of tutorials and hashed together a forward trace set up for when E is pressed another message appears. It’s placeholder for now while I figure the technology out. I created an interact interface and have implemented that into the blueprint. However, when E is pressed and the forward trace hits absolutely anything in the scene, the message pops up on the screen. I have no clue what I’ve done wrong. I’ve followed a couple of different tutorials independently with the same results.

Here’s some screengrabs of the Forward Trace and Interactable Object blueprint.

Can you show the code for the trace?

You send an Interact message to an object, and that objects decides to do something about it.


So it’s probably a matter of moving the top bit to the actor.

Otherwise actors that implement the interface currently do nothing about it. And then whatever was hit creates a widget.

Have a look at my non-green answer here:

I posted it not so long ago, it demonstrates the kind of interaction that you’re after (and more!). And there’s a project link so you can get hands-on with it.


It’s hard to tell how you set things up; but generally speaking, you implement an interface on an actor, that interface gives that actor a bunch of functions. You call the interface and the actor executes its own version of that function. Simplifying but that’s the gist.

Here’s the minimum that you’d need for the interface to work:

  • create an interface in the Content Browser - here called MyInterface and have an Interact function there

In the player blueprint:

  • show cursor
  • press 1 to send to message an acotor

In the actor that is supposed to receive it:

  • ensure this actor does implement the correct interface
  • implement the function

Compare the steps to your setup, see if you can spot the difference.

Yeah, I wanted to have something else happen to the object (visibility to toggle off) when the interact message comes in, but that didn’t seem to work, which is probably down to me not knowing what I’m doing, so I deleted it.

If I add something to the interact interface, will the whole sequence then work? I’m just trying to understand the logic. It was my understanding that: When E is pressed > initiate forward trace > if hits object with interface then display message > if not do nothing.

I’ll go try out your suggestion just now.

Unfortunately, moving the widget display to the interact interface event didn’t work. The message doesn’t display now, not even when pressing E on the object.

How would I do that?

There’s a lot of helpful information there, so first of all I’d like to thank you for going above and beyond.

Unfortunately, it’s a little information overload for my noobie brain. I think I understand the theory, but it’s implementing it into my own project that I’m struggling with. It’s been the same with following tutorials. They’re often not exactly what I’m looking for, so trying to adjust things to what I need has been a painful process. I’ll give an example from your post in that thread. It’s using a 3rd person setup, so you’ve got a get hit result under cursor. I would assume that wouldn’t be feasible for a 1st person setup, which is why I’d use a line trace/forward trace, right?

So as it stands, the forward trace is hitting any object and triggering a ‘true’ response. When it hits an object with the interface it isn’t triggering the interface event. Is there any information I can provide which will make it easier for you to tell where it’s going wrong?

This?

Okay, replicating the third person w/ cursor setup works. So how do I implement that with a traditional first person setup without using the cursor?

Nothing is printing. I tried remaking from scratch as well and still nothing.

He means your Forward Trace function - you might passing True for HitAnything but not pass the Hit Actor.

Yours should be fine at a glance unless you’re hitting something strange. Can you tell what this prints on your end.

Technically, the static mesh should respond to the trace since it is blocking but then we’d need to explore how it’s set up, too.

Okay, I’m an idiot. Forgot to connect something. So it’s printing a bunch of asset names around the interactable object, but not the object itself.

Okay, so here’s the object details:

Static mesh collision

Collision box details, just in case

Of course it was something so simple!

Thank you so much. You’re a star!

Print String is the best debug tool ever. Word.


Can you show the object you’re interacting with, especially its collision settings. Assuming the actor you want to interact with has a static mesh, it would look like this:

Yup, that’s it. You’re tracing on Visibility (line trace by) channel but it’s not being blocked here. Set the Collision preset to Custom and ensure the Visibility is Blocked.