How to Properly Set Up a Door Blueprint with Animation Trigger in UE5?

Hi all,
I’m trying to create a simple door in Unreal Engine 5 that opens when the player gets close and presses a key (like “E”). I’ve already created a Blueprint with a static mesh for the door and a trigger box, but I’m not sure how to set up the animation and input correctly.

Specifically, I’d like to know:

  • How to animate the door opening (timeline vs animation asset?)

  • How to trigger it only when the player is inside the trigger box

  • How to prevent the door from reopening/closing multiple times too fast

If anyone has a good example or can point me in the right direction, I’d really appreciate it!

Thanks in advance!

Hey @eyn71864 how are you?

I highly recommend this tutorial that explains exactly what you need!

There is this other tutorial that gets the same result with a slightly different approach!

Hope this helps you!

Regarding animation, if you went the timeline approach - you’d be looking at setting a timeline that would dictate the rotation (if it opens like a normal door) or location (if some futuristic sliding door) of your door. For rotation, for example, you could would move a value between 0 and 90 over time. Then, you hook up that timeline to update the actor rotation of your door. To close the door, you can play the timeline in reverse. The animation would be more about authoring the animation, and then setting the door to “play” that animation.

As for only triggering when in trigger box / pressing E to open, there’s many different approaches - and it may vary based on how robust you want your interaction system to be. But to start with a very simple implementation: you could detect if the player is close enough to interact, and if so allow the interaction input to be processed and send a message to the door to tell it to “open”. This might include:

  • setup a trigger box around your door actor
  • setup logic on your character to detect if you’re in range of a door (overlapping).
  • have your player keep a reference to any door they are currently overlapping, via overlap start/end events.
  • on your player - setup a binding for interaction on E, which checks if you’ve got a reference to a door set, and if so - tell that door to open (which would perform your rotation logic).

This is a basic implementation which won’t require you to be facing the door to open it. To create something more robust, you’ll likely want to create trace-based interaction, which relies more on the casting outwards from the player to check for interactable actors, rather than overlaps. This might consist of constant traces to detect “is a door in front of me” so you can tell it to show its interaction prompt”, and / or a trace when the interact key is pressed to find any door thats within the trace distance and tell it to be “interacted with”.

As for not having door open / close too fast, you could gate the interactable logic based on if the door opening is “in progress”. You can set a bool on your door which would represent if the opening animation timeline is running, and only permit a door to open / close if not already opening/closing.