How to get name GridMap cell?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Tort
:warning: Old Version Published before Godot 3 was released.
print(grid_map.area_get_name(1))

Error: Condition’area_map.has(p_area)'is true. returned: “”

What does this p_area?

Do you want to get an area or cell?

I don’t know how the area thing works, but if is a cell item name, to obtain it get the name from the MeshLibrary with get_item_name

eons | 2016-12-06 12:56

Thanks!

		var cell = get_node('ray_niz').get_collider().get_cell_item(self_pos[0]-0.5, self_pos[1]-1.5, self_pos[2]+0.5)
		print(get_node('ray_niz').get_collider().get_theme().get_item_name(cell))

edit:

cell = get_node('ray_niz').get_collider().get_cell_item(round(self_pos[0]), round(self_pos[1]-1), round(self_pos[2]))

Tort | 2016-12-07 13:02

Good! I’ll add it as an answer.

eons | 2016-12-07 15:58

:bust_in_silhouette: Reply From: eons

To get the name of a cell item, MeshLibrary has the get_item_name method, using a valid index.

For an item index at specific location, use GridMap get_cell_item with GridMap coordinates (not global/local translation).


Respect to Gridmap areas (those that can be “painted” with the editor), I don’t know the use, seems to be related to portals and rooms.