XLIVE99 / AutoGrid

Autotile system for gridmap in godot engine
MIT License
51 stars 3 forks source link

Autotile not placing right tiles #5

Open stesproject opened 3 weeks ago

stesproject commented 3 weeks ago

I'm trying to paint some tiles but it looks like only "closed" tiles autotiles correctly, if I open some angles I get the wrong tiles as shown in the image: Screenshot 2024-06-21 192852

I read the documentation and tried to toggle Performance mode, but it does not make any difference. I'm using version 1.2 on Godot 4.2.2 with the demo project.

PS: Sorry I didn't mean to post in that discussion, I got your reply notification via email and it misleaded me (I replied directly to the email).

XLIVE99 commented 3 weeks ago

I couldn't get the same result as yours. But it seems like you are trying to place a different tile than the autogrid recognizes. While autotile can still work with this, in some cases, it can place wrong tiles. Please select the tile ends with "_agrid". image_2024-06-21_223908010

And can you make sure you are painting with these settings: image_2024-06-21_224234555

If this doesn't solve the problem can you share more details?

stesproject commented 3 weeks ago

Thank you very much, the autotile mode wasn't set to "Minimal 3x3". Now it works :) Is it possible to draw autotiles also on the X axes? If yes, how should I set up the tiles? image

XLIVE99 commented 3 weeks ago

Yes, you can draw autotile in all three axises. Demo project only uses X & Z axis because it has only ground tiles. You have to create your bitmasks to use it in Y & Z axis. Please read the "Creating Bitmasks" section of the "HELP.pdf" file inside "addon" folder. After you have created the bitmasks, you have to set "Tile Normal Axis" to "X Axis"

stesproject commented 3 weeks ago

Yes, you can draw autotile in all three axises. Demo project only uses X & Z axis because it has only ground tiles. You have to create your bitmasks to use it in Y & Z axis. Please read the "Creating Bitmasks" section of the "HELP.pdf" file inside "addon" folder. After you have created the bitmasks, you have to set "Tile Normal Axis" to "X Axis"

Hi, I read the documentation but there's many things not explained.

  1. Where do I set the tile texture?
  2. How do I set up the bit mask?
  3. Shouldn't be enough to set "Tile Normal Axis" to "X Axis" to paint the demo tiles on the X axis with autotile working?
XLIVE99 commented 3 weeks ago
  1. It depends on your tiles, you should check the Godot 3D material documentation for it. I upgraded from Godot 3 to Godot 4. The tiles scene (DEMO/res_2D/Ground_MeshLibrary.tscn) is all white right now because of the upgrade. But built meshlibrary from Godot 3 is still impact, that's (I think) why tiles have a texture on it while we can't see it in the scene.
  2. You will have to create a scene for MeshLibrary. After creating MeshInstance for each tile, you can enable "Edit Mode" and then there will be a "AutoGrid" button as shown in the documentation. You might need to re-select (Selecting another node then selectin MeshInstance again) the MeshInstance after enabling the "Edit Mode" if "AutoGrid" button doesn't show up. Then you can create bitmasks from the "AutoGrid" button for the selected tile (MeshInstance).
  3. AutoGrid works same as TileMap's autotile but just 3D version of it. In 2D there is only 2 axises to worry about but in 3D you have to specify the normal axis of the tiles to correctly calculate bit values, AutoGrid was only calculating as every tile's normal axis is Y in version 1.0, but it led to a problem as you can see here. Tile Normal Axis only changes the check order of the tiles to correctly place tiles, that option doesn't rotate the bitmasks. Therefore that's why you have to create correct bitmasks for that axis.

I will record a video both in Godot 3 and Godot 4 to show how to use the plugin but I don't have enough time to record it as of now. And unfortunately I won't have time for like a month but I can try to squeeze it in my schedule. There is also another closed issue with detailed steps which might help you.