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.
asked Aug 16 '16 at 03:04 AM in C++ Programming
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.
answered Aug 16 '16 at 03:54 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here