Very recently I got a bug report from a user playing my game Guts & Blackpowder, and he was saying that as of the latest Roblox update he’s been experiencing issues placing down sapper buildings in places where he could before. I investigated this and found out that in the code where it checks if the surface being placed upon is flat enough, the math.acos function was returning nan. Looking further into it, I found out that the RaycastResult was returning a normal that would usually be (0, 1, 0) as (0, 1.0000001192092896, 0). I was able to reproduce this bug in an isolated place file with the specific UnionOperation that is causing this issue.
Screenshot with decomp geometry turned on:
ReproduceUnionSurfaceNormalBug.rbxl (56.2 KB)
In the place file there’s a script in workspace called “Reproduce” that does a raycast straight down onto the troublesome Union’s face, and it outputs the surface normal and then a math.acos(Vector3.yAxis:Dot(result.Normal)) which returns nan because the dot product is greater than 1.
Expected behavior
This exact place 100% used to not do this. I can easily account for this bug, but it’s annoying nonetheless. It should always return a vector with the length of exactly 1 (I know about floating point errors, but this didn’t happen before)