Replies: 2 comments
-
Sorry to answer an old topic but I'm facing this issue right now and making so many duplicate tiles to handle this is killing me, and this is the only relevant link I've been able to find. Do you know if there has been any news about this since, or an existing issue I wasn't able to find? Thanks |
Beta Was this translation helpful? Give feedback.
0 replies
-
Note that TileMap is now deprecated and new projects are directed to use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Here's the problem:
A common and natural way to do mapping is something like this:



You draw a river on your map
it has collision, preventing the player from walking over it
You want to make it crossable, so you put in a bridge you designed which has appropriate collision
Unfortunately, in Godot, collision is strictly additive, so you end up with this


instead of this
This is a big enough problem for workflow that multiple people have proposed and implemented methods for turning off physics on a particular layer, ( see #6881 #4236 #3092 ), which have been rejected since this puts too much control into the TileMap compared to the TileSet (per groud, "we have to draw a limit to what belongs to the TileSet and what belong to the TileMap."). Nevertheless, people keep wanting an easy solution so they can get back to mapping.
The current methods for working around this additive physics situation are:
A) make duplicate versions of all your tiles that might be underneath something, then map those alternate versions in under your bridge after placing it
B) leave a hole in your TileMap, put in a second TileMap underneath it with no physics, and map everything under it
C) attach a script to your TileMap that, at runtime, dynamically changes physics of underlying tiles to remove them
All of these have problems (such as breaking the visible collisions feature in the map editor), and are time consuming to do as a dev. B and C also are a TileMap-based solution instead of having this property decision belong to the TileSet, which isn't ideal
I think there's room for a better solution that's based on a property in the TileSet, which would make it easy to just plop down bridges wherever you needed to, and have them work the way you want without needing to alter your node structure, create new tiles, or code in special runtime exception.
Tiles in the TileSet should have override_lower_layers boolean property. If this is set to "True", any other tiles in a TileMap with the same x and y coordinates which is on a lower layer will not create physics colliders.
(In the case where multiple tiles have this flag, the one on a higher z-level will blank colliders of everything below it regardless of whether the flag is set.)
I think there are several distinct advantages of handling this problem this way. First, it keeps the solution in the TileSet and makes the behavior universal across all TileMaps, keeping tile properties where they belong.. Second, since it is not calculated at runtime, you can still preview the collision of your map in the editor, making it easy to test what can and can't be walked on without having to rub your character all over every object. Third, this is by far the easiest way to solve this specific use case - if you put a bridge with this property onto any TileMap the player will immediately be able to cross it, no problem, no special preparations needed. And if you later remove the bridge, it won't leave behind an empty walkable patch of river that you might forget to fix.
Beta Was this translation helpful? Give feedback.
All reactions