#Removing collision from TileMap tiles in backgorund

21 messages · Page 1 of 1 (latest)

dull wraith
#

Hi, so I am creating a Simple Platformer to increase my skills and I made a TileSet and also a TileMap, which has a foregorund and a background. I use the same tiles for both of them. How can I remove the collision propertys of the backgorund layer?

charred hull
#

I don't believe that is possible.

dull wraith
#

Oh no

#

What if I make a new TileSet, where I do not add the collision shape -> using the same tiles for it?

#

In the Atlas

charred hull
#

I found this

extends TileMap

func _use_tile_data_runtime_update(layer: int, coords: Vector2i) -> bool:
    return layer in secret_layer_ids

func _tile_data_runtime_update(layer: int, coords: Vector2i, tile_data: TileData) -> void:
    tile_data.set_collision_polygons_count(0, 0)
#

was a reply to this merge request

#

so maybe it is possible after all

dull wraith
#

What would I use as the Vector2i argument?

charred hull
#

the tile coordinates

dull wraith
#

So I write to every single tile?

charred hull
#

if this script works, not really.

dull wraith
#

I just do not get how I would use this function

charred hull
#

yeah, I never used it. So I am not sure about the performance impact

dull wraith
#

Hm, I will try both ways let's see...

#

But thanks!

charred hull
#

and to be honest, reading it again, I think it will messed with the collision for both layers

#

because the tile is shared

#

but the guy in the thread said it worked