Door Delay Using Timers

New variables in the header file:

FTimerHandle CloseTimer;

UPROPERTY(EditAnywhere)
float CloseDoorDelay = 2.0f;

Using the timer

        if (PressurePlate &&
		PressurePlate->IsOverlappingActor(ActorThatOpens)) {
		OpenDoor(DeltaTime);
		GetOwner()->GetWorldTimerManager().SetTimer(CloseTimer, CloseDoorDelay, false);
	} else if(!GetOwner()->GetWorldTimerManager().IsTimerActive(CloseTimer)) {
		CloseDoor(DeltaTime);
	}

Ended up with a delay value of 0.8 seconds

1 Like

Nice looking code. Make sure you are posting in the unreal forum.

Privacy & Terms