Swinging door or Using the same key on two different collision boxes in the same blueprint

Hi there, complete beginner here.

I just started, read and viewed different UE5 tutorials and am currently testing and training some blueprint creation.

So I’ve build a door which opens by pressing “E”. It does this by using a collission box + Timeline+Rotator for a smooth door opening experience™. Now I want the door to be a swinging door, opening both ways.

So what I did was adding a second collission box, now one at both sides of the door, copied the code and just set the rotation to -90° instead of 90°. It works perfectly, but the problem is, the “E” key always triggers both rotations and I haven’t found a way to tell the “E” key to do this when my character hits collission box A and do the other function when my character hits box B.

I’ve tried to add a “Branch” to check wether my character is in box A then trigger 90°, or if it’s false, then trigger box B. But it doesn’t work, I am a total beginner so I wonder if there is something wrong with my branch, or if there is something flying over my head completely?

Imgur

Imgur

So how can you make a key do different things in the same blueprint? Thanks in advance!

Hey @Kafka-esk you can check what side the player is with a single collision and getting the dot product of the direction to player against the door forward vector.

For example:
DoorBothWays

I would also suggest you try and keep all inputs in the possessed pawn. Look into interfaces to help you with this.

Hope it helps.

Thanks for the reply!
I’ve read that you can solve this problem by using direction vector, but I thought it should work just by using two collission boxes and making them rotate in different directions as well.

I managed to make it work now though! The “Get Owner” node under “Is Overlapping Actor” of my Branch in the first screenshot was the mistake. I deleted the node and put the “box” directly on “Is Overlapping Actor” and now it works perfectly.