How can I make a Camera2d snap to a grid

Godot Version

4.5

Question

I’m wondering how I can make a camera2D snap to a grid, based on where the mouse is clicked. I have code to move the camera to the mouses position, but it looks very strange since its unaligned with the tile map. Is there a way I can get the mouses position, then align it to a grid so the camera looks better?

snapped()

1 Like