Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: UE 4.12
more ▼

asked Aug 16 '16 at 03:04 AM in C++ Programming

avatar image

122 26 22 29

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Aug 16 '16 at 03:54 AM

avatar image

1.2k 31 8 40

avatar image joelComberiati Aug 16 '16 at 05:12 AM

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

avatar image joelComberiati Aug 16 '16 at 05:25 AM

https://wiki.unrealengine.com/Blueprint_Automated_Door_Tutorial#Initial_Setup 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?

avatar image Shohei Aug 16 '16 at 05:32 AM

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.

avatar image joelComberiati Aug 16 '16 at 06:34 AM

Okay, Good to know, you have been very helpful

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question