Door behaviour as Actor Component

Hi,

I’m trying to make a door actor component behaviour that could be placed on any object in the scene and that could be triggered by the character blueprint in order to open or close the door. I’ve tried a few things but nothing seems to work atm. I was wondering if others have tried doing it this way or could help me out.

Thanks

How do you want to open the door? Getting close to it, touching it, or hitting a switch somewhere?

It would be by touching it.

Hey, i’ve done something similar:

Here you can see an event which gets fired after i press a key(you could change this easily to fire after a collision overlapse or something)

The Flip Flop means it changes the flow after every iteration. The Timeline just increases a value from 0 - 90 every x millisecond → that means my door opens and closes pretty smooth.

-the “new param” variable is checked before if the thing i am looking at is a door, and if so, set the variable to it so u open the door u are actually looking at.

  • the “new track” parameter is just the value i increase from 0 - 90 (90 means the rotation fo the door is 90degrees in the end). As you can see i create a new rotator and set the Z-axis(yaw) to my timeline output(0-90).so its like a while loop where it increments the Z value by 1 until it reached 90.

Hi ƒanatiX,

Yeah I could do it this way but what i’m trying to achieve is through a BP Component instead of a BP like you have there. As an example lets say I have 15 different types of doors that open with different degree of angles/axis, I dont want to create 15 types of BP’s all I want to do is to have a Component that I can add to any static mesh in the scene with which i can set the axis, angle and rate of rotation.

@ik3ds: I would make a door actor instead of a door component (using blueprints as he has). You can expose angles/axis through exposed variables, and then when you place one in the world you can set which static mesh to use and what the angle/axis is through instance overrides. (When you place the door it will show up in the settings panel).

We do this for doors in our game and it works very well.

If you truly want it as a component, you can create a new blueprint component (add component → create new blueprint script component) that controls its parent’s position/rotation, and drag that into any door.

I’m not sure how much detail to go into, because I’m not sure how familiar you are with the system :slight_smile:

Thanks for taking the time for helping me out. Yeah I really want to have it as a component. I did the part that controls its parent/position in the component but i need the character to be able to activate the event and thats where im stuck.

So, because components can’t automatically include other nested components, I think you have several options:

(1) Expose a variable to a trigger box that can be set by the owning actor. In your component, bind to the onoverlap and trigger when that happens. The unfortunate part here is you have to create two components to attach to each door - a trigger volume and the actual rotator. This is probably the ‘best’ way to do it if you don’t have C++

(2) Inherit from Shape component. Then you could have the trigger and rotator in the same component. I think you need to do C++ for this.

(3) Don’t use the base collision system. You have to do work every tick but it’s not horrible unless you have 1000s of doors (and it requires the player to be the only actor that can open doors). Basically, check the players position every frame and see if it’s within a procedurally defined bounding box around the origin (or grab the boudning box of the actor and add some). This is the easiest way if you fit those constraints.

(4) Create the trigger volume in the beginplay of your rotator component, and attach. This seems reasonable too. Not sure you can dynamically create components in blueprint.

Thank you, I dont have C++ but I managed to figure it out. Just need to do a few tweaks now. Thanks again for your help!