Can anyone explain this Shapecasting behaviour?

Godot Version

v4.2.1.stable.mono.official [b09f793f5]

Context

For minimal context, I’m trying to represent the terrain with voxels and store it in an octree data structure. The data structure works but I’m experiencing some odd results from the shapecasting I’m doing to determine the terrain voxels.


Voxels that collide with terrain are shown as red cubes.

As can be seen in the image above, the shapecasting appears to be slightly biased towards edges of polygons - either that or something else.

I’ve tried using both IntersectShape() and GetRestInfo() for performing shapecasts in my algorithm and neither produces a correct representation of the terrain.

Question

Is there an explanation for this behaviour?