TerrainPatch has wrong CollisionDistance

Hi,



just wanted to inform you that the distance calculation of a CollisionResult with a TerrainPatch is wrong.



If I shoot a ray in this scene:





I get three results: TerrainPatch and twice the model (in and out). But exactly in this order! With distances 2.4, 67.1, 67.4 or something. Even if have a very big distance from the terrain and shoot at it, I still get impossible results like distance = 4.1 …



To help narrowing down the buggy spot: The terrain is not scaled nor rotated and is only translated along the xz-plane.



Cheers

Thanks Dodikles, I just committed a fix for it.

I believe I ran into the same problem a while ago, made a big post about it but it’s good to see this gets fixed =] Thanks Sploreg

Hi Sploreg,



thanks for the fast fix :slight_smile: