bevy_ecs_tilemap
bevy_ecs_tilemap copied to clipboard
Hexagonal tmx map will not render correctly
In Tiled Editor:
##In Bevy ecs tilemap:
This is t1.png
This is tmx file
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.0" orientation="hexagonal" renderorder="right-down" width="18" height="10" tilewidth="48" tileheight="54" infinite="0" hexsidelength="26" staggeraxis="y" staggerindex="odd" nextlayerid="2" nextobjectid="1">
<tileset firstgid="1" name="t1" tilewidth="48" tileheight="54" tilecount="1" columns="1">
<image source="tiles/t1.png" width="48" height="54"/>
</tileset>
<layer id="1" name="Layer 1" width="18" height="10">
<data encoding="base64" compression="zstd">
KLUv/WDQAeUBAFAAAQEAAQEBAQEBHaCAfWADSeohACiwECWHwVncQwOrX2HuohFAI8zdiZaXlO5S+myG50vazEDnIKfTOw==
</data>
</layer>
</map>
This is bevy_ecs_tilemap version
tiled = "0.11.0" bevy_ecs_tilemap = { git = "https://github.com/StarArawn/bevy_ecs_tilemap.git", branch = "main" }
Are you able reproduce this with the in-repo tiled
example and tiled
0.10?
Also, it looks like perhaps you've uploaded the first screenshot twice by mistake rather than t1.png
.
Reupload t1.png
in-repo helper has path bug if tmx more deeper
It has x not flip bugs(I already fix in OP)
Maybe i should extend TilemapBundle's map_size to double times and change every TilePos's x ?
It looks like the current example code assumes HexCoordSystem::Row
, which is an "even" stagger, but the Tiled map settings above are staggerindex="odd"
.
You want to use HexCoordSystem::RowOdd
or change the setting in Tiled.
I don't think we can fix this in the example until functionality is added to tiled
. https://github.com/mapeditor/rs-tiled/issues/261
I have a WIP branch about staggeraxis. I'll send PR after fix all founded bugs.
https://github.com/mapeditor/rs-tiled/pull/262
Finally fix this, but i found some strange.
Why I need swap RowOdd <-> RowEven and ColumnOdd <->ColumnEven then It render correctly?
https://github.com/StarArawn/bevy_ecs_tilemap/blob/main/examples/helpers/tiled.rs#L263
- TilemapType::Hexagon(HexCoordSystem::Row)
+ tiled::Orientation::Hexagonal => match tiled_map.map.staggeraxis {
+ StaggerAxis::X => match tiled_map.map.staggerindex {
+ StaggerIndex::Even => {
+ TilemapType::Hexagon(HexCoordSystem::ColumnOdd)
+ }
+ StaggerIndex::Odd => {
+ TilemapType::Hexagon(HexCoordSystem::ColumnEven)
+ }
+ },
+ StaggerAxis::Y => match tiled_map.map.staggerindex {
+ StaggerIndex::Even => {
+ TilemapType::Hexagon(HexCoordSystem::RowOdd)
+ }
+ StaggerIndex::Odd => {
+ TilemapType::Hexagon(HexCoordSystem::RowEven)
+ }
+ },
+ },
https://github.com/StarArawn/bevy_ecs_tilemap/blob/main/examples/helpers/tiled.rs#L280
- if tiled_map.map.orientation == tiled::Orientation::Orthogonal {
+ if tiled_map.map.orientation == tiled::Orientation::Orthogonal
+ || tiled_map.map.orientation == tiled::Orientation::Hexagonal
+ {
Could you do a separate PR to update our tiled
dependency to 0.11?