Baffling (to me) CloseDoor() issue

Up to the point I add the DoorCloseDelay check if statement, my BuildingEscape project works exactly as expected. When I add that statement, compile, and hit play, the doors open immediately and stay open. That is without moving the player which does not generate within he trigger volume. Even if the greater than sign was actually a less than sign, the if statement should not open the doors. I attached images of my opendoor.h and opendoor.cpp. One thing is that I have updated to unreal engine 4.14.0 and the lectures are 4.10.2 based. But, it;s hard to believe that would do this.

Since new users can only put one image in their posts, here is the other one that will be needed to see what’s going on in my code…;^)

By any chance is it opening in a different direction when you enter the trigger volume? Because I would imagine that setting the door’s absolute rotation to {0,0,0} isn’t a rotation that is considered “closed”

It does open in a different direction (I use + for out instead of -), but, the doors open properly from a trigger volume hit without the if clause - which shouldn’t be triggered on game start…at least I think it shouldn;t…;^) It look like (0,0,0) is correct for close, but, I’ll look again. Thanks!

I did fix it, but, it’s a little weird. I had to do two things. First, I had to set the LastDoorOpenTime to a large value (I used 99999.0f) in the begin play block in dooropen.cpp to stop the time delay check from triggering immediately. (It’s probably not a bad idea to do that anyway.) The other thing is that even through the rotation control says the door is at 0 when it is closed, I had to set the close angle to 180 degress in the closedoor() function. I do have my doors on the opposite end of the the floor from the lecture video so require a positive open angle (which works fine with 90 degrees), but, if the rotation control says 0 while setting up, it seems strange to me that I need 180 to close during play…? Well, at least it works now…;^)

Your code looks exactly the same as mine, and we’re using the same engine version, so I think the inconsistency must be some aspect of the door that is set in the editor. But at this stage of the game, if you can get it to work, great! :slight_smile:

Privacy & Terms