Using ShapeCasting to detect what square a character is "most in" (Grid-based strategy game)

Godot Version

4.3

Question

I’m very new to coding. Just got out of the constant tutorial phase and I’m trying to make my own stuff for the first time (and learning how little I know). Just adding context that I’m a godot baby.
Working on a top down grid strategy game. I have tiles that can hold a player, and use AStarGrid2D to make those tiles into a grid. The problem is: my character uses an ‘on_area_2d_enetered’ signal to detect the tiles, but doesn’t know which one to enter if it’s touching multiple. I’ve never used ShapeCast or its friend RayCast before, but I was wondering if I could use them to detect what tile the majority of the player is in? Or maybe I could make an array of multiple areas, and put the character in the tile that the most areas touch (seems overcomplicated though).
Thanks to anyone reading, any help would be appreaciated~

If the grid_tiles have all the same size you can just use the position of the player and divide it by the tile-size

Thanks, I’ll try that.