Aligning tilemap with underlying hex-grid

Godot Version

4.3

Question

I have a map of hexagon cells in a hexagon structure with sides currently set to 3x3x3

Now I want to superimpose a tilemap of pixelgraphics on the hexagons.

I draw the hexagons first, based on a pixelposition ‘pos’ and hexagon coordinates (q,r,s) and then I set the tile based on the (q,r) coordinates.

The size of the tiles match my hexagons and some of the tiles even align perfectly with the hexagons (after offsetting the tilemap (-120,-70) in the scene).

But not all tiles line up, and I’m stuck as to the cause.
It looks like this:

My tilemap is set to Hexagons, stacked offset by the way

Here’s the code for the function in question, I suspect my error lies somewhere with the s coordinate or an impoerfect understanding of what happens in vector2i?

Can anyone see where I’m getting it wrong? Chatbots are running me in circles :=)

func draw_hexagon(pos, q, r, s):
# Create the Polygon2D for the filled hexagon
var hexagon = Polygon2D.new()
var points = PackedVector2Array()

# Corrected tile coordinates for staggered hexagonal layout
var tile_coords = Vector2i(q, r + int(q/2))

# Draw hexagon sides
for i in range(6):
	var angle_deg = 60 * i - 30  # Pointy-top orientation
	var angle_rad = deg_to_rad(angle_deg)
	var point = Vector2(hex_radius * cos(angle_rad), hex_radius * sin(angle_rad))
	points.append(point + pos)

hexagon.polygon = points
hexagon.color = defaultColor
add_child(hexagon)

# Create the Line2D for the outline
var outline = Line2D.new()
outline.points = points
outline.closed = true  # Connect the last point to the first
outline.width = 4  # Outline thickness
outline.default_color = Color(0, 0, 0, 1.0)  # Black outline
add_child(outline)

# Setting tile cell in the TileMap
tilemap_layer.set_cell(tile_coords, 1, Vector2i(0, 0))

I just needed to convert my global position to tilmap positions and not worry about q,r,s…

var local_pos = tilemap_layer.to_local(pos)  # Convert to TileMap's local space	
var tile_coords = tilemap_layer.local_to_map(local_pos)  # Get hex tile coordinates
tilemap_layer.set_cell(tile_coords, 1, Vector2i(0, 0))