Take into account grids that may be half offset

main
copygirl 11 months ago
parent 37e6befc0f
commit de12776f90
  1. 2
      objects/Grid.cs

@ -88,7 +88,7 @@ public partial class Grid : Area3D
pos += halfSize[(int)axis] * normal; pos += halfSize[(int)axis] * normal;
// Snap the position to the grid. // 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); pos = halfOff + (pos - halfOff).Snapped(StepSize);
return new(GlobalBasis * basis, GlobalTransform * pos); return new(GlobalBasis * basis, GlobalTransform * pos);

Loading…
Cancel
Save