The code doesn’t make any logical sense to me. How is it actually delaying to close the door? Where is the actual delay?
All the if statement says is that if the time you leave is greater than 1.0f, then close the door. No where in the actual code does it say to delay the door closing.
I’ve been stuck trying to figure out where the actual delay is for hours. The CloseDoor(); method doesn’t have a delay in it, just an angle to close at. So where is the actual delay? How does it know to delay closing the door?
In Blueprints, you can set a simple Delay node and this is done in 5 seconds. But I don’t see where the actual delay code is for c++. All I see is that the time is > the other time, so close the door. There’s no actual delay in that though.
Example:
if(GetWorld()->GetTimeSeconds() - LastDoorOpenTime > DoorCloseDelay) //
{
// shouldn’t there be code right here that says to delay for 1 second?
CloseDoor();
}