From de12776f9001e572e5d8bd9875904129755cd72a Mon Sep 17 00:00:00 2001 From: copygirl Date: Mon, 1 Jan 2024 17:45:30 +0100 Subject: [PATCH] Take into account grids that may be half offset --- objects/Grid.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objects/Grid.cs b/objects/Grid.cs index 40e25a9..414b541 100644 --- a/objects/Grid.cs +++ b/objects/Grid.cs @@ -88,7 +88,7 @@ public partial class Grid : Area3D pos += halfSize[(int)axis] * normal; // Snap the position to the grid. - var halfOff = basis * halfSize.PosMod(1.0f); + var halfOff = (basis * halfSize + _halfGridActualSize).PosMod(1.0f); pos = halfOff + (pos - halfOff).Snapped(StepSize); return new(GlobalBasis * basis, GlobalTransform * pos);