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.

This commit is contained in:
Jamie Greunbaum 2023-03-31 14:40:49 -04:00
parent 5816ec390b
commit 7fa9e77c47

View File

@ -162,13 +162,18 @@ void ABugPlacerPawn::Activate()
UGameplayStatics::GetPlayerController(this, 0)->Possess(this); 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); this->GetWorldTimerManager().SetTimer(this->TraceTimerHandle, this, &ABugPlacerPawn::TraceTimerElapsed, TraceInterval, true);
} }
void ABugPlacerPawn::Deactivate() void ABugPlacerPawn::Deactivate()
{ {
this->GetWorldTimerManager().ClearAllTimersForObject(this); this->GetWorldTimerManager().ClearAllTimersForObject(this);
this->GetWorldSettings()->SetTimeDilation(1.0f);
UGameplayStatics::GetPlayerController(this, 0)->Possess(this->OriginalPlayer); UGameplayStatics::GetPlayerController(this, 0)->Possess(this->OriginalPlayer);