Hello,

I am creating a tool to allow me to build a procedural tilemap terrain. I have a water, grass and dirt tile. I added collisions using the paint feature. I want to remove collisions from the tiles, but only from a specific tiles. in this case I want to remove the collision from the grass and dirt tiles. I want the player to interact with only the water tile.

  • Toxe replied to this.

    AadarshDevi What have you tried so far? Did you get any errors? What is the exact problem?

    What I have already done was
    variables

    1. layer: TileMapLyer

    process:
    layer.collisions_enabled = false.

    i been trying to find more resources for my problem but no luck.

    there was something with tiledata but i was not able to understand it.
    didnt understand something to do with _set_physics_collisons_layer() and _set_physics_collisons_mask().

    these are all I can remember at the moment.

    I haven't used TileMaps since Godot 3, and they've changed a lot since then.

    I found this April 2023 tutorial that may be helpful:
    https://www.nightquestgames.com/adding-collision-to-tilemaps-in-godot-4/

    I suppose you need to put the water, grass and dirt tiles in separate collision layers, so that you can control them independently.

    Here's the documentation on Collision layers and masks (not specific to tiles):
    https://docs.godotengine.org/en/4.4/tutorials/physics/physics_introduction.html#collision-layers-and-masks

    The basic idea is that an object with layer L1 and mask M1 can collide with an object with layer L2 and mask M2 if (L1 & M2) != 0 or (L2 & M1) != 0, where & is the bitwise AND operator.

    I am using TileMapLayers not TileMaps. I want to make the tiles in different collisons layers but I don't know how to do it.

      AadarshDevi TileMapLayers not TileMaps

      Apparently TileMapLayer's have replaced TileMap's in Godot.

      But I don't think that's relevant here, since the collision layer/map is associated with the TileSet's used by the TileMap or TileMapLayer.

      TileMapLayer has TileSet, and TileSet has Tiles. I want to get the collisons of the tile (grass or dirt tile) and remove them. The way I found so far is to remove the entire tilemaplayer's collisions. If the player is on the base layer, I want to remove grass and dirt tile collisions meaning it will only collide with water tiles. the player will also collide with the layer above, the terrain, layer 1.