adrien-bon / bevy_ecs_tiled

Helpers for working with 2D tilemaps created with the Tiled map editor
MIT License
35 stars 8 forks source link

Try to fix Hexagon(RowEven/RowOdd/ColumnEven/ColumnOdd) collider bugs. #39

Closed darkautism closed 1 week ago

darkautism commented 1 month ago

Fix Hexagon colider bugs

image image

darkautism commented 1 month ago

Need this patch: https://github.com/mapeditor/rs-tiled/pull/313

darkautism commented 1 month ago

Do not fix #41 . If you want to flip the Y axis, do it independently.

darkautism commented 1 month ago

Also fix IsoCoordSystem::Diamond image image

adrien-bon commented 1 month ago

Hi!

Thanks for the PR and the example to reproduce the issue. Actually, it seems we have an issue with colliders from tiles for hex and iso maps. We only tested colliders from objects, not from tiles. Now I understand your issue.

Regarding your code:

darkautism commented 1 month ago
adrien-bon commented 1 month ago

I pushed an update to your PR in order to re-use the example assets from the repo instead of yours. Unfortunately, it seems your fix does not work with them.

FYI I just updated both hex_map and isometric_map examples. You just have to run them with either avian or rapier feature enable:

cargo run --example isometric_map --features=avian
cargo run --example hex_map --features=avian

Could you please have a look and fix the maths so these examples work ?

darkautism commented 1 month ago

This patch fix the tile collider not object collider. I think this is helpful: https://bevyengine.org/examples/animation/custom-skinned-mesh/

adrien-bon commented 1 month ago

This patch fix the tile collider not object collider.

Yes I know what you want to fix here. What I am saying is that when I add tile colliders to the existing examples in the repo your fix does not work. For instance, in the 1st screenshot,tile colliders should be on the mountain. Not to their left.

I think this is helpful: https://bevyengine.org/examples/animation/custom-skinned-mesh/

Not sure what do you mean ?

darkautism commented 1 month ago

According to #32, these object deformers not only have incorrect positions, they also need to be deformed.

adrien-bon commented 1 month ago

32 is another issue that applies only to isometric maps, where colliders have the proper position (at least object colliders) but not the proper shape.

Here we are trying to fix tile colliders not having a correct position, both for hexagonal and isometric maps. As I said, I think the maths you added do not fix the tile collider position issue. Please, have a look to the screenshot I posted (there is an issue with hexagonal maps too, not only isometric).

If we reach in this PR a status where tile colliders have the correct position but not the proper shape for isometric maps I'll consider it done and that the shape issue will be fixed in #32.

adrien-bon commented 1 week ago

I'm closing this PR since the tile colliders positionning issue is now fixed in v0.4.0.