BreakHitResult Branching (Interactive Crosshair)

Rocotos
Fri, 20 Mar 2020 11:58:47 +0000
UI

Hello there!

While learning the basics of blueprints, I got stuck with one strange thing. What I’m trying to do is to change the crosshair image when the player gets close to an interactable object (door, in particular). I use LineTraceByChannel method, that works perfectly fine with the door animation. So I decided to copy-paste it for a new task.

But it works only partially: new crosshair appears when I am near the door, but then remains and do not disappear. I understand why. There’s no branching after LineTraceByChannel node and its EXEC pin is connected directly to the custom made Crosshair_change event. But… how can I branch it? The HitActor pin can only be connected directly to a target, as it is Actor Object Reference. And the Branch node does not work with that.

Is there a way to branch HitActor pin to tell the script that when there is no raycasting interaction with the door, the crosshair image should not be printed? I tried to find some other ways of solving this puzzle, including an entirely different method of working with crosshair images, but found nothing.

It’s important to mention: I am new to programming and blueprint logics, so to me it is still very hard to come to solutions, that may seem obvious. My apologies for such questions. Thanks!

38 posts - 1 participant