TileMap Custom Data.

Godot Version

4.2.1

Question

Hi all, im stuck with this for over a week and i cant get my head around on how this works. The setup:
I have a Area2D that if collides with the tilemap (name = tilemapObjects) it pass the reference of the tilemap to the Player from the player in the physics_process() im passing the global_possition

(var tileData = _tilemap.get_tile_data_at(global_position))

of the player to the tilemap function

func get_tile_data_at(_position: Vector2) -> TileData:var local_position: Vector2i = local_to_map(to_local(_position))return get_cell_tile_data(0, local_position)

after this call im calling in the player

if(tileData != null): print("DO SOMETHING)

The problem: When i collide with the tilemap i get the reference and i pass the position of the player it to the tilemap but when i want to get the tileData is says that there is no custom data. If i place the tile to be above the ground and the player collides with the tile it works as intended how could i get the tile if its bellow me or on the side of the wall or above? My thought was if i have a collision with the tilemap i can get the custom data at the collision.
Tilemap Setup picture:

maybe im late but:

		for i in get_slide_collision_count():
			var collision = get_slide_collision(i)
			#collision.
			if collision.get_collider() is TileMap:
				#print(collision.get_collider_id())
				#print(collision.get_collider())
				var tile_data=collision.get_collider().get_cell_tile_data(1,collision.get_collider().get_coords_for_body_rid(collision.get_collider_rid()))
				#print(collision.get_collider().get_coords_for_body_rid(collision.get_collider_rid()))
				#print(tile_data.get_custom_data_by_layer_id(0))
				if tile_data.get_custom_data_by_layer_id(0)=="wall":

here’s how i make my enemy detect a wall and do something. the enemy is a characterbody2d. so this snippet is in func _physics_process(delta):

hope this helps

Note:
the wall is at layer 1 hence why the get_cell_tile_data first parameter is 1, so this will need to change according to your wall layer or anything