Tilemap built at runtime and collision issues

In my project, when I load a level dynamically, the level has a tilesource associated with it in the *.lua file.
I use this string to load the static tilemap (level map in my collection as a placeholder) with a source file resource that has collision data set from within the editor. What I assumed would happen with the tilesource swap is the collision hull data would swap with it, but instead it retains the default tile’s collision mapping data and uses it when I use tilemap_settile(). The tile displayed is correct and from the newly swapped tilesource, but the collision hull info is still from the default tilesource which causes tiles that should not have physical attributes to have collision shapes.

What can be happening here?

Tiles swapped in before tile setting like so…

	local source = loader.getTileSource(mapFile)
	local source_id = go.get("/resources#script", source)

	if source and source ~= "" and source_id then
		go.set(mapUrl, "tile_source", source_id )
		go.set("/overlay#game_level", "tile_source", source_id )

If there is a problem with engine and tilemap collisions you could look into this GitHub - selimanac/defold-tile-raycast: Ray Casting in tiled worlds using DDA algorithm.

1 Like

My engine / code is pretty similar. My issue deals with omething I believe the engine supports allegedly. My system is dependent on the current engine specifics and this issue is a small, but critical ailment.

Attempting to implement a new system this far into development would be too time consuming.