BP door template that can be customized

Hello, i been trying to setup a Template BP for my door system so i can just use child doors which works fine.
But now i had an idea to make the template customizable but dont know what best practice would be.

My idea is to have the door template and add child actors that is instance editable so i can place it in my level and then just click in the viewport what attributes (locks, windows, handles etc) the door should have.

I also wanted to make it so if the child actor is hit by my characters linetrace it reacts (locks open, boards fall off door etc. (this failed completely for me…).

I tried to make it with child actors but my lacking skills in programming stopped me in the tracks and i guess there is a super easy way to do this once you know how. I also consider if child actors is the way to go since its a lot of casting from the parent to the child.

Hope someone can guide me in the right direction of how to set this up!
(or a tutorial if it exists)
And Happy new years!

output
Hi @Luthorisscname,

There’s a couple ways you could set this up depending on how you want everything to interact. Here’s one setup with a board and a lock that can get you started.

Attaching child actors to the door is a fine solution - particularly if you want them to stick around after they’ve been detached from the door.

Component Setup


For this setup, I’m just using some simple static meshes. I’ve added two extra scene components - a BoardAttachPoint and a LockAttachPoint that are rotated to where I want the board and lock to go.

  • I positioned them by putting a ChildActorComponent under them, setting its ChildActorClass to be my board or lock, and then deleting that component when I was done setting the location and rotation of the attach point.

Variables


I setup these variables, with HasBoard and HasLock being Instance Editable and Readonly so you could set it in the details panel while editing your level.

Door Logic

Here’s the main logic for the door. It reads in the variables of HasBoard and HasLock, spawns them if desired, and then listens for them to fall off. If the player tries the door, it either opens or not based on them being present.


The lock and board just have a little code to respond to being interacted with - turning on physics, detaching themselves, and calling a custom event dispatcher that will let the door know they’ve fallen off.

Hope this is helpful!

This is awesome!! Thank so much! I manage to make my own version last night that I will try to post later this evening! I did it slightly different using a construction script in my child bp that then talks to a separate bp deciding what actor to add to the parent!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.