I created an animated object in Blender and imported it into UE5. I managed to set up the animation as follows:
When I press E, the first half of the animation plays, and the doors open.
When I press E again, the second half of the animation plays, and the doors close.
This works fine unless I press E in the middle of the opening animation. When that happens, the animation is interrupted, and the second part plays immediately.
Ideally, the first part of the animation shouldn’t be interruptible—it should play to the end even if the player presses E. Only after the first animation has finished should pressing E trigger the closing animation.
Another issue I’m facing is setting up a collision so that the player can’t walk through the doors.
Any advice would be greatly appreciated!
this is a blueprint setup
Hello! That should be easy to accomplish by having a new bool state variable.
You can create a new boolean variable named “IsInteractingWithDoor”.
In the E key event, first check if this variable is true, in that case do nothing. If it’s false, set it to true and then do the rest of your nodes.
Right after the Stop node, set that variable back again to false.
You can use a Do Once node and reset it once the animation is completed
(A little more practical way than what @NLaurito has suggested, I also used to do that before knowing the existence of that node. But it’ll function the same.)
Also, you can use a Flip Flop node to reduce your current blueprint code by half! As it eliminates the need for the current bool type variable you have, along with separate inputs.
As for collision, make sure that the object response for pawns is set to block and to set up collisions, you can double click on your mesh, and from the Details window there, under the Collision section, select the Use Complex Collision as Simple from the dropdown menu next to the Collision Complexity setting. And also tick the checkbox next to the Customized Collision setting. Even though I didn’t experience any issues with that collision setting myself, I heard some issues with it but I think it’d be appropriate in this case.
Thanks for the quick reply! I don’t want to sound picky, but could you draw for me how I should connect this new boolean? If yes that would be a massive help for me.
thanks
You can also do it the way @VisAgilis mentioned. The implementation is shorter, but since the current state remains hidden inside the DoOnce node, you may need to refactor it later if you want to expand upon this system and have access to this variable from elsewhere. It’d be something like this:
Hi, thanks for the advice! I found the settings you mentioned and think I set them up correctly, but there’s another issue.
Now my character can’t pass through the door when it’s closed, but also can’t pass through when it’s open.
Thats my seetings for box collision in psychic assets . is there a possibility that this door are to narrow ? When they are fully open . and box is holding player back ?
Ignore the box scale issue . wrong bone and size.
I’ve already fixed it. Adjusting the player collision shape was a great suggestion—after resizing it, everything works fine.
It’s been a long day for me. Thanks for your help!