Help with gridmap raycast detection

Godot Version

4.2.2 (Steam)


I am currently working on a “displacment cannon” for my randomly generated 3D game. It acts similar to a Minecraft pickaxe, destroying whatever GridMap tile is in the players raycast. Since the size of the gridmap cells are 2, I have to use the function local_to_map() in order for the correct cell to be broken. As of right now, I have it so only blocks level with the player on the y axis may be broken. But for some reason, every cell seems to have 2 sides next to each other that can be mined, and the other 2 force the cell in front of it to be mined. For instance, one block’s N/E sides can work, but it’s W/S sides won’t, or another block’s W/N sides will work, but it’s E/S sides won’t. Here is the code:

elif currentweapon == "displacer":"breaking")
		if aimcast.is_colliding():
			var collider = aimcast.get_collider()
			if collider is GridMap:
				var collision_point = aimcast.get_collision_point()