GetAbs() for FIntVector

Is there a GetAbs() for FIntVector type? What is the library for it?

this is only way to do it, that i know about:

FORCEINLINE FIntVector GetAbs(const FIntVector& Vec)
{
    return FIntVector(FMath::Abs(Vec.X), FMath::Abs(Vec.Y), FMath::Abs(Vec.Z));
}
1 Like

Why don’t you get each abs() of Vector?

	FIntVector IntVector = FIntVector(1,-1,1);
	UKismetMathLibrary::Vector_GetAbs(FVector (IntVector.X, IntVector.Y, IntVector.Z));

I am use FMath::Abs() on each element atm, but just wondering if there is a function for FIntVector since FVector does have GetAbs() included

tbh don’t have a very big knowledge why it doesn’t in the low level, however with UKismetMathLibrary you can get abs of a vector directly.

	FVector MyVector = FVector( FIntVector(1,-1,1));
	UKismetMathLibrary::Vector_GetAbs(MyVector);

The only annoying this is that I need to cast back to FIntVector again

I’m gonna close this post now, I’ll mark the first reply as solution

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.