+1 vote

From what I understand, each TileMap node can only be on one layer, so I made bottom, middle, and top layer TileMap nodes for different kinds of tiles. But if I do something like put a tree trunk on the middle layer and the tree top on the top layer, the player can go behind and in front of the tree (which is good), but he can also stick his feet through the tree (from above), or stick his body between the top and middle layer tiles. He's some pics of what I mean: good, good, bad, bad

Normally I guess I would put StaticBody2D nodes to block the top of the bottom tile and bottom of the top tile, but then that would break the Navigation, because I have to either have an entire tile be a NavPolyInstance or have no NavPolyInstance but a StaticBody2D instead.

Anyone else having issues with multi-tile trees/objects on TileMaps that have NavigationPolygonInstances in them?

in Engine by (846 points)

1 Answer

0 votes
Best answer

Okay so I just took long hard look at the Isometric demo, and the answer to the Z sorting issue is basically automated by Godot already. The trick is to attach the character and mobs as children of a TileMap node, then enable the TileMap node's Z-Sort checkbox. This will automatically allow the character to move in front of and behind trees! Except I'm not sure how well this works with normal tiles, but it works amazingly for isometric tiles, so I'm going to convert my game from normal 2D tiles to isometric.

Just to clarify, I'm pretty sure this only works well if all the mobs/objects you want to be Z-Sorted are on a single tile. So multi-tile trees don't seem ideal, but I think there are tricks to get around that for things like forests.

by (846 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.