Setting Up Door Open/Close In C++

Hello,
I am trying to simply open and close a door. I have a few ideas of possible methods, but I am not sure which one, if any, are the best. Now what I do is create a blueprint on the AInteractableDoor class, and then place it in my world. Now technically this would not only be used for doors, it would also be used for windows that can possibly slide upwards, or be the classic house style door that opens in/out, or it could even be a sliding door that goes to the right or the left. No the easiest way I can think of to do this, is have an animation that I can set in blueprints where I can just hit play when I want to open it. I have seen a timeline being talked about for the most part. But since I would have to work with blueprints a little more than I would like (cant do it in c++ because I cant change it in the blueprint, unless there is a way to do this I am unaware of, highly likely). The other option is create a position/rotation that I would like the door to get to, and get there through the tick function. These are just the things I could think of, if there is a better way, Id be glad to hear it.

Timeline and animations are the way to go. If your trigger condition is met (pressed interact key, walked into a trigger box, whatever), trigger an event in your blueprints that starts the Timeline. The output float value of the timeline determines how far in the animation it needs to be. You would play the timeline in reverse to close the object.

By the way, this type of behavior is what blueprints are really made for outside of prototyping. The trigger is fine in C++, but the events caused by the trigger in regards to cosmetics should be done in blueprint.

Okay, I have not done much with animation, I will give it a try

So After looking through this, it seems pretty simple. I can pretty easily get this to work, but it looks almost identical to what I would do in c++. Is doing it this way more efficient in some way? Or is it simply due to ease?

Ease is relative. I find blueprints harder to use than C++. The tutorial there works fine as well with the only difference being they manually set the actual location of the mesh instead of using an animation. There really is no difference whether you do it in blueprints or C++ as this kind of thing wouldn’t really benefit from C++'s speed benefits.

Okay, Good to know, you have been very helpful

You can also follow this tutorial: https://unrealcpp.com/open-door-with-timeline/