Coming from Blueprints, I’m trying to Normalize a Vector.
Based on Google, it seems like the way to do it is to check SafeNormal and then Normalize. However, I’m unsure how they are specifically stored since the two functions return a bool. Is the normalize a void function itself?
bool UTest::Normalize(FVector Input, float Tolerance, FVector &Output) {
if (Input.GetSafeNormal(Tolerance))
{
bool Result = Input.Normalize(Tolerance);
}
Output = Input;
return Result;
}
Would this work? The question more importantly that I’d have would be is the Normalized Vector now Stored in Temp? What does tolerance really mean in terms of how Units reflect on the result?
1 Like
Input.GetSafeNormal(Tolerance);
Input.Normalize(Tolerance);
Output = Input;
This worked.
I used this inside Blueprints and compared with the standard Normalize provided by KismetMathLibrary. With Tolerance of 1.0, the equal operation returns true even when comparing them with a 100th unit as a tolerance.
3 Likes
Now i founded that unreal have bug since it was developed in 90’s in its own normalize node with tolerance for blueprint. The tolerance value we pass in blueprint does not affect anything. i think the node have its own tolerance to 0.01 and this is not good value according to unreal cm unit system. So if you change the tolerance it will not work.
And this is the node that is used every where in game dev.
So i think we will need to write our own small code for this in c++.