On getting the camera location: you might want to use the APlayerCameraManager instead of casting to the player character. It’s a cleaner approach and helps keep your Blueprint simple. You also won’t have to revisit this bp if the pawn ever changes.
Going a little off topic… I know your just starting, try to learn for curated youtube channels, reviewed courses and conferences. There is a lot of free content that will do more harm than good.
We should try to avoid this type of wiring and go for code that is easy to manage and iterate uppon.
Just imagine what it would look like programming an actual elevator with these features:
- Press button, wait to close door if open and then move to floor.
- When arriving at floor, open door, wait, close, then move.
- Button to close door.
- Button to open door.
- Beep if door is open for too long.
- Queue multiple buttons, make them glow when queued.
- Clear all floors in a single direction before clearing the queue in the opposite direction.
- Go to first floor if no queue.
- SOS button to stop and sound an alarm, then turn off and continue.
- Panel in each floor to call elevator (both up and down).
There are patterns to make these type of mechanisms work without our heads exploding. In the future if you ever want to go beyond any tutorial consider diving into these topics:
- State machines (the brain pattern of the elevator).
- Child Actor Component for the buttons and door.
- Event Dispatchers | Unreal Engine 4.26 Documentation To handle communication between door, buttons and elevator

