Flip Flop reverse doesn't work - double door

Hi,
I’m trying to open and close a double window with left mouse click, for an archviz.

A strange thing is happening that I cannot explain to myself. I have a working double window, if I use the same code on another blueprint, it doesn’t work properly: they open but do not close. I was careful to update the targets and box collision: it doesn’t work!

I hope someone can help me. Thanks in advance!

Did you enable input in the blueprint?

That was exactly the problem, thank you so much!
… but now there is another one: there are 4 windows and the players seem to conflict with each other. If I set all 0 it doesn’t work but it doesn’t work even if I set different numbers…

What could be the reason?

I am working with a third person player.

This is the other part of scripting, I thought is needed:

I’m still having the problem with the players: changing the input doesn’t solve the problem totally …

You also need to clear this

349345-screenshot-1.jpg

Thanks for answering me again!
It works but generates a new problem: they open and close at the same time - if I set player 0 and clear the check. I tried to set different players: it doesn’t work but I don’t think this is an error.
They should only open if you click, they must be independent from each other.

PS: The problem with reading a mouse click, is you aren’t reading anything about the player whereabouts. So it’s working perfectly.

And so, you have come to the next big question in blueprint interaction. There is a solution floating around youtube, which is easily understandable, but not great.

Put a collision box around your BP, and only allow interaction if the player is in the box. You can either do that by enabling input on overlap, or checking for overlap when the button is pressed.

The downside of this is a bit of extra programming every time you make an interactable object, and… you can open the door with your buttt.

The generally accepted ( and superior ) method, which only works when the player is facing the object, but takes more programming to get it off the ground, is a line trace and blueprint interfaces.

Basically, on mouse click, the player does a line trace to what’s in front of them. If there’s an object there, it sends a blueprint interface message saying, ‘hey, I interacted with you’, and the object can respond accordingly.

The list of benefits of this method, outweighs the buttt method by quite a long way, and includes:

  1. You only have to get it working once, then you can interact with any actor

  2. Err… number 1, but even more so, because you can call a BP interace on ANY actor, it just doesn’t have to respond.

  3. It’s very easy to make it modular, all you have to do it write the response in the interactable stuff.

And so on, here’s a vid about interfaces and line traces:

https://www.youtube.com/watch?v=yo9VrxFgUJY

Thanks very much for the explanation.

I’ll see the videos and do some testing and then I’ll let you know. The collision box is there, on every BP but I think another part of the script is missing due to my inexperience.

I’d prefer the line traces method. I think that the two links refer to the same video but no problem, I’ll document myself.
Now I know what to work on, thanks to you.

Link fixed :slight_smile:

Thank you! :slight_smile:

UPDATE:
I studied, tried and failed, then I found this video that should be exactly my case:

[UE4 Doors system / Open Close (Part 1 / 5) - YouTube
][1]

I followed it in every step but I surely still do something wrong because it doesn’t work. The only change I had to make was to use a Scene for the Component because my pivot is badly positioned.

Where am I doing wrong? I made an interface, a structure and a door master. I made my door a child of the master and set input of ThirdPersonCharacter. I’m really freaking out…

RESOLVED

The line trace did not work because it conflicted with the script to show the mouse. Unfortunately for me, I only realized it after migrating the project, building the lights, etc… 5 hours of work later.

No door system was needed, as you advised me, I set up an interface and added a simplified collision box on each element I want to interact with. Now I can open them autonomously on click, as I wanted.

Thanks so much again for the help!

Here are the links of the tutorials I followed, if someone after me should have my problem :slight_smile:

https://www.youtube.com/watch?v=OFxGs5WlBYk&list=WL&index=2

https://www.youtube.com/watch?v=wbbBAyYlxU4&list=WL&index=1