From 7fa9e77c47ff52ea6d067798e7c1dde2bd9e7007 Mon Sep 17 00:00:00 2001 From: Jamie Greunbaum Date: Fri, 31 Mar 2023 14:40:49 -0400 Subject: [PATCH] Restored time dilation when BugPlacerPawn is active, since it seems the freezing that occurred was related to bad NVidia drivers and not frame times hitting zero. --- Source/Unrealzilla/Private/BugPlacerPawn.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/Unrealzilla/Private/BugPlacerPawn.cpp b/Source/Unrealzilla/Private/BugPlacerPawn.cpp index 54c19ef..51a5ff6 100644 --- a/Source/Unrealzilla/Private/BugPlacerPawn.cpp +++ b/Source/Unrealzilla/Private/BugPlacerPawn.cpp @@ -162,13 +162,18 @@ void ABugPlacerPawn::Activate() UGameplayStatics::GetPlayerController(this, 0)->Possess(this); - float TraceInterval = this->GetActorTickInterval() > 0.0f ? this->GetActorTickInterval() : 1.0f / 60.0f; + const float &MinTimeDilation = this->GetWorldSettings()->MinGlobalTimeDilation; + this->GetWorldSettings()->SetTimeDilation(MinTimeDilation); + this->CustomTimeDilation = 1.0 / MinTimeDilation; + + float TraceInterval = this->GetActorTickInterval() > 0.0f ? this->GetActorTickInterval() : (1.0f / 60.0f) * MinTimeDilation; this->GetWorldTimerManager().SetTimer(this->TraceTimerHandle, this, &ABugPlacerPawn::TraceTimerElapsed, TraceInterval, true); } void ABugPlacerPawn::Deactivate() { this->GetWorldTimerManager().ClearAllTimersForObject(this); + this->GetWorldSettings()->SetTimeDilation(1.0f); UGameplayStatics::GetPlayerController(this, 0)->Possess(this->OriginalPlayer);