Line trace end trigger event?

Not too long ago, I used a collision box overlap to trigger a level sequence playback that basically keyframed opacity of a material from 0 to 1. So I had a “On component begin overlap” node going to a “Create level sequence player” node, and that one going to a “Play” node. Than I had a “On component end overlap” node going to another “Create level sequence player” node, and this one going to a “Play reverse” node. This was for a frame on the wall, let’s call it a painting to give you an idea.

So the player would walk to the space of the collision box, the opacity of the painting would go from nothing to full, and when the player walked out the box space, then the painting would slowly disappear.

I’m trying to achieve the same thing but with a line trace. This is the same line trace I used for other things in the project, so I know it works. It’s set to 500 so the player has to be right in front of the painting for the sequence to play.

Here are the two problems I have:

  1. I connected the exec output from the line trace to a cast to the object I hit with the line trace (the painting on the wall), with the object input connected to the “Hit actor” output in the “Break hit result” node. Then I connected the exec output of the cast to object node to the “create level sequence player” node. So this should trigger the sequence playback when the line trace hits the object but no. It triggers it when the player moves out of the area, meaning, when the line trace is not hitting that object anymore.

And to make it more weird, if I connect the “Cast failed” output to the sequence node, it works as intended, it plays the sequence when the line trace hits the painting on the wall. So this defies logic, and I’ve spent hours yesterday and today trying to figure it out.

  1. My goal is to be able to play the sequence in reverse when the player leaves the area, meaning the line trace wouldn’t give a hit result for that particular frame on the wall. But even if I go by the upside down logic of this blueprint and connect it to the regular exec output instead of the cast failed one, and send it to the node group that would play the sequence in reverse, the result is not that, when the player walks back and the line trace doesn’t hit the painting anymore, it goes back to the regular state, but all of a sudden, not over 1 second like it would if it was executing the reverse playback node.

Any ideas? Here’s the blueprint:

First of all, I strongly suggest using a Timeline instead of a level sequence. Timelines are a lot easier to work with, and you can reuse your curves there instead of creating separate level sequences for different animations.

As for your issue in particular, I guess the problem is that you Play Reverse, but the playback position is 0, so it snaps to it immediately. With timelines, there’s an option to Reverse From End; I don’t know if there’s something similar with sequences, though.

The main outtake is this: use timelines for simple stuff like that. Your quality of life will increase drastically.

1 Like

Thanks, actually I had use the sequencer because when I did the other thing, I got that from a tutorial on YouTube. And I kind of remember doing something with timelines instead, but I can’t remember what it was.

Now, how would you use the timeline in this blueprint?

1 Like

Thanks. I’m trying to figure out what type of nodes are the red ones that have the condition “Is picture hit” and then there’s two more but as set nodes. I searched the list of nodes even with context sensitive unchecked, and couldn’t find any node called “Is actor hit” or similar. The only thing that comes to mind is to create a boolean variable called “Is picture hit”, and that looks exactly like yours, but the variable itself doesn’t reference anything if it’s set to boolean, so how would that work exactly?

Yes, it’s a bool you create yourself. Its purpose is not to call the timeline multiple times, but only when the condition changes.

Thanks for clarifying that. So I have the whole thing almost complete, but the only problem now is the target for the static mesh component node that goes into the “set scalar parameter etc” node. In your example, it says it’s a cube. In my case, the target would be a blueprint that has three components, the regular painting frame, and then two components that are each a plane, and each with a texture instance, which are the two textures that I want to appear gradually over a second.

I tried several things but nothing worked. Is this group of nodes supposed to be in a specific blueprint? I have it in the main level blueprint, and I also tried in the blueprint that has those three components, but no luck.

Make the timeline in the painting blueprint, and make Custom Event to play and reverse it. Make everything before the timeline in the level BP (or better in Character BP), and the timeline in the painting. Then cast the Hit Actor to your Painting and call the custom events you’ve created.

OK so I think I follow part of what you suggested, but I’m not clear on the “call the custom events”. I know that if you’re in a different blueprint, you can create variables for the other blueprints in the game and then get or set that variable on the event graph, which points to the blueprint you established. But when it comes to custom events, I have no idea how to call them. I tried creating a variable for them, but I didn’t see them anywhere.

Oh, and by “character BP”, do you mean the player controller class BP selected in the world settings?

To create a Custom Event, right click in the event graph and type “custom”, it’ll be there. You can name it whatever you want, and then you can call this event by its name from the same BP or from other BPs, if you have a reference to the BP where you created a custom event.

by “character BP”, do you mean
Either your character, or your controller, or Level BP for now to see how it works.

This “Play Timeline” is a custom event you create yourself, and you can add parameters to it in details.

Sorry, how did you get the custom even that has the forward pin? Because in my case I only see one pin, the white exec one, but no forward pin. I went up and down the list and the only custom event is that one. Could it be that I’m in 4.23 and that is a newer feature?

Sorry, I did some digging and found that you can add it to the custom event afterwards.

OK, so I just finished setting up all the nodes exactly as you did to the best of my understanding, and when I click play and walk close to that painting, nothing happens. I know the line trace is hitting the painting because I setup another blueprint to change the cursor when it hits that painting. And that still happens, but as for the plane that has the material that I want to appear over the painting itself, that’s not happening.

I’ll keep digging tomorrow in case I missed anything, just too tired to do it today, but I really appreciate your help on this.