Ok, so i have another idea.
I have searched and find that i can get "shape" property from tileset if i know tile ID
My new idea is to create new scene with root as "Area2D" node and child as shape, let's call this scene "road"
and then at game start i will iterate through all tilemap cells and get tile IDs. With that i want check if current tile has a "shape" if so, then i want to instantiate "road" scene and set collision shape to the same as tile's shape
I write code for that:
extends TileMap
onready var road = preload("res://Terrain/RoadScript.tscn")
func _ready():
print("Get Cell IDs")
var tileset = tile_set
for i in get_used_cells():
var cellID = get_cellv(i)
var shapeCount = tileset.tile_get_shape_count(cellID)
print("shapeCount: "+str(shapeCount))
if shapeCount > 0:
var shape = tileset.tile_get_shape(cellID, 0)
var roadScene = road.instance()
add_child(roadScene)
roadScene.get_node("CollisionShape2D").shape = shape
But my new problem is, how i can add a shape to the tile in tileset:

I tried to add collisionshape2d child to the tile sprite but my script shows shapeCount = 0 for every tile