Multiple Line Trace Triggers for a Single Blueprint?

Hi. I’m currently trying to figure out if it is possible to have different events occur depending on what specific component of a blueprint a line trace hit.

The current example of this is an elevator with two buttons. One button I want to open and close the door (the logic for this is inside the elevator blueprint). The other button I want to move the elevator up and down between floors (again, the logic for this is inside the elevator blueprint). Both buttons are static meshes inside the elevator blueprint.

I can get one or the other to work with a line trace, but am unsure how to have both work depending on which button the line trace hits. Or if that is even possible.

Any help would be appreciated. I’ve been banging my head against this problem for days now lol.

It sounds like your line trace overlaps the blueprints. Well, there are tons of ways to fix this, and one of them is to create some gaps/spaces between each blueprint class. Other than that, you can also try to see the components of the blueprint class instead of the actor when the line trace hits. But, opening the idea of opening/closing the door that is set on a button press is not a good design, I think. Let it be two buttons to move up and the other to move down instead.

Most of the time if the buttons are independent static meshes it won’t be a problem unless you have some overlap components inside an actor class, then you will need to do some tags.

It’s all inside one blueprint with the buttons being separate meshes. That being said, I think tags is the way to go, I just know almost nothing about how they work. I’ll look up some tutorials on them I guess and report back if that solves the issue.

As for the button idea, I kinda misspoke initially. The elevator only has to move down so there is no need for two buttons with one going up. As for the door open/closing, since that’s how elevators operate normally I thought that would be best for the design. Would you recommend overlap triggers instead?

Thanks!

Give the button collisions a component tag. On trace hit get the component tag.

Hit Component → Component Tags → Get a copy (0)

1 Like

Hmmm. I rarely see a design where the game asks the player to press two buttons that supposedly lead to the same function in the end. In short, your door will close/open anyway when it needs to, right?

Simply do not close the elevator’s door until the player presses the button to move. It’s basically a design to avoid annoyance to the players when they need to press two buttons every time they want to use the elevator.

That makes sense for the door closing actually. But I do want the player to have to manually open the door. Them making the decision to open the door or not on each floor is one of the main mechanics I’m thinking of for the game.

This was pretty much what I wanted! This post also goes over my exact problem here: If Player LineTrace hits a particular component of an Actor

Thanks so much!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.