Download

Open door using a gate key press in object blueprint

Hey people, so as the title says what I’m trying to do is open a door through a key press.
I have a blueprint which contains all the door stuff such as meshes, trigger box and bp code I have it all in one bp so I can duplicate it without having to add more to other bps.
Here is my bp:
d98afe1638b3875afb1db8f9f51195a4a96dd96b.jpeg
So this is in my door bp which I know won’t work because key presses won’t work in this type of bp.

So I was wondering if somebody could give me advise on how I would go about doing this?

Thanks!

Maybe a “stupid” question, but is the door animated?

Just have this in your BP, & key input will work.

https://docs.unrealengine.com/latest/images/Gameplay/HowTo/ActorInput/Blueprints/input_1.jpg

Yeah it is animated :stuck_out_tongue:

Thanks starseeker that looks like what I want!

Hey, That works fine but the issue I’m now having is that it only works on one door and none of the duplicates, however if I don’t use a gate and just let the BeginOverlap start the animation then it works on all doors.

I’ve made a video so you can see the problem as it is rather than me giving a rubbish explanation. :stuck_out_tongue:
https://youtube.com/watch?v=q6QiLvLXwPc

What could be causing this? :S

Thanks

YOu can try disable consume input & try again. Could work. By default, one key can only execute one node.

input_9.jpg&d=1413392299

I would however have a boolean, & have the door open only when you are near the door, & you click E. This may prevent all door from opening at same time, or maybe its not an issue.

You may also wanted to (under Project Settings->Engine-> Input-> Add ‘E’ as a ‘use’ event under custom mapping.

Then instead of directly call ‘E’, you CAN called event ‘USE’, & make a branch…(see picture)
Input01.JPG

Well you could also do a trace on keyhit and then if it hits an actor try to cast that to your door bp and then call the open event or whatever you are useing

Thanks! Unticking consume input worked fine.

Thanks again!

Thats a quick fix. A more elegant solution here.

Basically, instead of calling from the BP, you call from the character blueprint. This way you have better control, as you can easily set your priorities/condition as the USE event all come from a single source (Character Blueprint)

f3633695914df97b8a234a103b009f3f88c59411.jpeg

In any case, there are many ways to do the same thing. Obviously if you have 1000 of the same class, looping everyone is a poor solution, but if you have 5 instance in a level of the same class, its not a big issue.