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!