My Project Editor keeps crashing everytime i run this line of code. The code compiles fine no errors at all and its in Tick cause i need it to check every frame.
if (AVLDVisual::VectorLenghtForActor() < PlayerLocationPrevious)
{
SubtractCurrent = UKismetMathLibrary::FClamp(UKismetMathLibrary::Subtract_FloatFloat(CurrentValue, UKismetMathLibrary::Divide_FloatFloat(UGameplayStatics::GetWorldDeltaSeconds(this), UKismetMathLibrary::Multiply_FloatFloat(0.09, RadiusScale))), VolumetricCloseUpDensity, CurrentValue);
CurrentValue = SubtractCurrent;
}
else
{
if (AVLDVisual::VectorLenghtForActor() > PlayerLocationPrevious)
{
AddCurrent = UKismetMathLibrary::FClamp(UKismetMathLibrary::Add_FloatFloat(CurrentValue, UKismetMathLibrary::Divide_FloatFloat(UGameplayStatics::GetWorldDeltaSeconds(this), UKismetMathLibrary::Multiply_FloatFloat(0.09, RadiusScale))), VolumetricCloseUpDensity, VolumetricDataSaved);
CurrentValue = AddCurrent;
}
else
{
}
}
Also how do u see the code running when im in PIE if there is a way.
So it seems its not those lines of code that it crashes but in my timerManger.SetTimer =/
So got it to work 100% the way i wanted it to.The old line of code is still there its commented and added a printToscreen for debugging. Still want to know why the old Solution doesnt work if its the same jsut calling functions to do math operation.
New Solution:
if (CurrentActorVectorLenght > PlayerLocationPrevious)
{
//AddCurrent = UKismetMathLibrary::FClamp(UKismetMathLibrary::Add_FloatFloat(CurrentValue, UKismetMathLibrary::Divide_FloatFloat(UGameplayStatics::GetWorldDeltaSeconds(this), UKismetMathLibrary::Multiply_FloatFloat(0.09, RadiusScale))), VolumetricCloseUpDensity, VolumetricDataSaved);
AddCurrent = UKismetMathLibrary::FClamp(CurrentValue + (UGameplayStatics::GetWorldDeltaSeconds(this) / (TimeSpeedCount * RadiusScale)), VolumetricCloseUpDensity, VolumetricDataSaved);
CurrentValue = AddCurrent;
FString TheFloatStr = FString::SanitizeFloat(AddCurrent);
GEngine->AddOnScreenDebugMessage(-1, 1.0, FColor::Red, *TheFloatStr);
}
else
{
if (CurrentActorVectorLenght < PlayerLocationPrevious)
{
//SubtractCurrent = UKismetMathLibrary::FClamp(UKismetMathLibrary::Subtract_FloatFloat(CurrentValue, UKismetMathLibrary::Divide_FloatFloat(UGameplayStatics::GetWorldDeltaSeconds(this), UKismetMathLibrary::Multiply_FloatFloat(0.09, RadiusScale))), VolumetricCloseUpDensity, CurrentValue);
SubtractCurrent = UKismetMathLibrary::FClamp(CurrentValue - (UGameplayStatics::GetWorldDeltaSeconds(this) / (TimeSpeedCount * RadiusScale)), VolumetricCloseUpDensity, CurrentValue);
CurrentValue = SubtractCurrent;
FString TheFloatStrB = FString::SanitizeFloat(SubtractCurrent);
GEngine->AddOnScreenDebugMessage(-1, 1.0, FColor::Yellow, *TheFloatStrB);
}
else
{
}