Rotate statue 90 degrees?!

Hello everyone, I am developing a puzzle game on UE4 as my first game.

There are statues in the game that the player can rotate, in my blueprint I used timeline to rotate the statue 90 degrees if the player click on it, everything is working great, but the issue is after rotating the statue the Z value of the statue will be 89.999992 instead of 90.

any help?

The same thing happens when you manually rotate an actor in your scene as well. So it’s not due to an error in your code or anything, it’s about decimal precision. You can try fixing this by adding an additional logic to your existing rotation code, like rounding it’s world rotation if it’s not already.

You could also try using double precision floats but if that also doesn’t work out, here’s a post I found that might be helpful :innocent: How can I increase float precision in unreal engine 5? - #4 by EliasWick

1 Like

Hey there @P-LoThRiC! I agree with @VisAgilis, where you could round the value or alternatively you could compare with Nearly Equal with an error range.

image

1 Like

@VisAgilis @SupportiveEntity

I would lie if I said this community isn’t the best, thank you for helping me out!