This function is perfect! Thanks a lot!!
The best you can do is multyply de number for 10^n (n=the number of digits you want to acotate) and do a Round to Integer64 to avoid the rest of the decimals.
In case someone using C++ to solve this problem but do not want to use third-party library: use FString to avoid float inaccuracy.
Code:
static float GetDecimicalResult(float Number)
{
constexpr int Accuracy = 100; //Just example, you can set accuracy as an function parameter
const int BigRoundResult = FMath::RoundToInt(Number*Accuracy);
const FString IntPart = FString::FromInt(BigRoundResult/Accuracy);
const FString DigPart = FString::FromInt(BigRoundResult>0 ? BigRoundResult%Accuracy : (-1)*BigRoundResult%Accuracy);
return UKismetStringLibrary::Conv_StringToFloat(IntPart + TEXT(".") + DigPart);
}
Hello, I am learning scene creation using UE5 and I am new to the domain at large as well. I don’t really understand where and how to include this function to effect the import settings of the world. Can you please post a screenshot of how to use this function or direct me to a resource that does it? To give a little context, I am dealing with .obj files where the vertices are being rounded leading to degenerate object error. I need to have configure the settings to take atleast 5 floating point precision to work with the tiny assets I have.
Hello, I am learning scene creation using UE5 and I am new to the domain at large as well. I don’t really understand where and how to include this function to effect the import settings of the world. Can you please post a screenshot of how to use this function or direct me to a resource that does it? To give a little context, I am dealing with .obj files where the vertices are being rounded leading to degenerate object error. I need to have configure the settings to take atleast 5 floating point precision to work with the tiny assets I have.
I used a function for a cooldown timer to show nothing if 0, Integers if above 1 and decimal when below 1. The “To text Double” has a dropdown for Fractional Digits so that you can control the precision
works well
If you Drag off your Float Value and Get the Conver to Double node and then use a To Text Node from the output you can set the maximum Fractional Digits in the Drop Down settings of that Node If you Drag off your Float Value and Get the Conver to Double node and then use a To Text Node from the output you can set the maximum Fractional Digits in the Drop Down settings of that Node
Great answer, I went with the middle option as AsCurrency (Float) is deprecated, and AsCurrency doesn’t have the same options.
For anyone needing to implement this solution, I’d suggest abstracting it into a pure function as such Works great, thanks Denny
Thank you!
It’s work for me)