Ue4 Line-trace door bug

So I have this pretty strange bug with my doors. In my FPS blueprint I have a linetrace that casts to my door blueprint. I am using a flip flop so when my linetrace hits, one of my values will be 90 degrees and that will rotate the door, but when it hits again, the rot value goes 0 degrees and the door closes.

However, when I open one door, and try to open the other door, it makes the closing door noise and doesn’t open. I have to press ‘e’ again for the linetrace to open it and then the door opens. This is because it’s the same blueprint and it thinks it’s the same door or something of that sort I think. I don’t want to have to use multiple door bp’s if possible, so any help would be appreciated. Thanks!!!

Hello Dan,

Try this:

Create a custom event inside of your “LinetraceDoor” BP. Put all of that logic in doorbp2.png in the custom event.

Then, after casting to lintracedoor, call the function (aka custom event) on the door (drag from pin “As Linetrace Door”)

I think this will solve your problem!

Thank you so much, this worked like a charm!

Hey, I don’t know if you have the time right now but the doors work great except I have an AI and I made it so that when it enters the box trigger on the door bp, it will open the door, then when it leaves the box trigger, the door closes. I have successfully made this however, when I open the door first myself, the the ai comes and closes it, and I try to open it, the door blueprint thinks that I still have it open and I am closing it even though it’s already closes, so it just makes the closing sound and closes.

However, I want to open the door when it’s closed by the AI, not close it again. How can I do this? Screenshots will be below, thank you for taking your time to read this! Hope this isn’t too much.

You’re welcome! Thanks for the screen shots. It seems strange to me that you are calling “LinetraceDoor” and your ai is calling “OpenDoor” - each flip/flop node would have it’s own state.

Do you have more than one flip/flop in your door BP?

No sir, I only have one flip/flop and it’s in the linetrace door function which is in the door BP
This is the function for the player to open and close the door which is in the door BP’s. I did not share a screenshot of this yet.

So how come the AI is not calling “linetraceDoor” - or is there something inside the AI’s “OpenDoor” that casts to/calls “linetraceDoor” on the door?

Hi, I just replaced the open and close door function with line trace door function and it seems to work because of the flip flop except there’s another problem now. When the AI enters the box trigger, it calls the linetrace door function and he opens the door, but when he exits the trigger box, it calls the linetrace door function again and that closes it because of the flip flop.

However, if I open the door first, he’ll close it when he enters the box trigger because the player and the ai are calling the same function, so I will open door, then flip flop and the AI will close the door.

Also no, there is nothing inside the open door that casts to linetraceDoor. Sorry if I am not making much sense.

Haha, I follow you - Two things that come to mind would be having an “open door” and “close door” function in your door (avoiding flip/flop entirely) the other thing would be adding logic to the door to know to ignore an overlap in certain situations

Okay, so I have the Open and Close door functions that simply open and close the door when the AI enters or exits the box trigger on the door. So you want me to use the open and close door functions for my player as well without a flip flop? How would I go about doing that?

And how would I go about adding logic that would know when to ignore an overlap?
I’m sorry if I am asking so many questions but I am not very good with blueprints at all.

Let’s just try to keep this on the topic of doors. Casting to a specific actor is a good way to ignore overlaps on most things, but I think the missing key for both of these problems is the use of Booleans/Branch Node. (Use the boolean to turn on/off functionality) Same logic applies for unifying door logic (bIsDoor open → if true fire closing logic, set bIsDoor open to false)

Run through this playlist to build a solid base for BP knowledge!

Thank you so much for all your help! I finally got the doors to work for the player and the AI. The AI can now open doors normally and when the door is already open is doesn’t do anything. I did this using branches and bools. So I made it in the linetracedoor function that when the door is open, “IsDoorOpen” is checked, then when it’s closed, “IsDoorOpen” is not checked. Then I used a couple branches and got the bool variable and now everything works pretty good! Thanks for all the help!