It took my way too long to figure out where my code is not doing what it should be doing.
I don’t understand why this doesn’t work. Especially, because I saw more or less the same code in a tutorial.
So here is an example:
const FVector2D CurrentLocation1 = FVector2D((4 + 1) / 10, (4 + 1) / 10);
UE_LOG(LogTemp, Warning, TEXT("CurrentLocation1: %s"), *CurrentLocation.ToString());
const FVector2D CurrentLocation2 = FVector2D(0.5, 0.5);
UE_LOG(LogTemp, Warning, TEXT("CurrentLocation2: %s"), *CurrentLocation.ToString());
The log says
CurrentLocation1: X=0.000 Y=0.000
CurrentLocation2: X=0.500 Y=0.500
Why is that? Am I missing something here? Why can’t I do basic calculations in the declaration of the FVector2D while in the sample project I got this from they are doing all kinds of calculations in that line?
Edit: It seems like the problem lies in the division because (4+1) logs as 5 while (4+1)/10 logs as 0. But I still don’t understand why divisions shouldn’t be possible.