Skip to content

Instantly share code, notes, and snippets.

@vorixo
Created March 24, 2021 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vorixo/3743e3c095315f334e28047bb5960d25 to your computer and use it in GitHub Desktop.
Save vorixo/3743e3c095315f334e28047bb5960d25 to your computer and use it in GitHub Desktop.
Ensures that your physics settings are appropiate for your precision target.
#if WITH_EDITOR
const UPhysicsSettings* Settings = UPhysicsSettings::Get();
if (Settings && GetWorld()->GetTimeSeconds() > 5.f)
{
const float RequiredSteps = GetWorld()->GetDeltaSeconds() / Settings->MaxSubstepDeltaTime;
if (!ensure(RequiredSteps <= Settings->MaxSubsteps))
{
const FString SimulationMessage = FString::Printf(TEXT("The simulation requires more steps to be representative at the current Delta Time. Consider increasing MaxSubsteps if you desire MaxSubstepDeltaTime precision. Required Steps: %d"), FMath::CeilToInt(RequiredSteps));
PRINT_TICK(SimulationMessage);
}
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment