Download

Floating Point Imprecision - Problems with my Transforms.

I’m trying to do some procedural generation using instanced static meshes. I have tunnels made of modular, equally-sized pieces. However, because of the nature of floating points, a piece’s rotation value sometimes 90.00000008, or the scale is sometimes 0.9999999. This becomes a problem because you start to see seams in the pieces. Here is a clip showing what I mean (make sure you do 1080p): Floating Point Problems.webm - Google Drive

Does anybody know how I can circumvent this, if at all? If I can’t, what would you all suggest?
[SIZE=1]
Edit: I tried using FMath::FloorToInt, FMath::FloorToFloat, FMath::RoundToInt, and FMath::RoundToFloat, and none of them work; My rotation value ends up being +/- 125.264389, and adding instances using this rotation value causes the editor to crash.[/SIZE]