Kiamo2 / YATI

Addon to import Tiled maps into Godot 4
MIT License
141 stars 18 forks source link

fix: import errors when tile has polyline collision shape #36

Closed mark-rafter closed 9 months ago

mark-rafter commented 9 months ago

Added support for tile polyline collisions

Kiamo2 commented 9 months ago

Hmm, I didn't consider that someone here could/would generate a polyline. Which (on tiles) has no equivalent in Godot. But I'd prefer to do the same as with points and ellipses: skip it. And not create a polygon (which additionally would fail if the polyline had only 2 points). Could you go along with that?

mark-rafter commented 9 months ago

Hmm, I didn't consider that someone here could/would generate a polyline. Which (on tiles) has no equivalent in Godot. But I'd prefer to do the same as with points and ellipses: skip it. And not create a polygon (which additionally would fail if the polyline had only 2 points). Could you go along with that?

Well when exporting a scene from Tiled, polylines work, so I assumed YATI would have feature parity, but importing my maps with polylines caused an exception to be thrown by YATI. With this simple code change, there is now feature parity and I don't have to manually edit all my polylines into polygons, see:

image

Kiamo2 commented 9 months ago

Are you sure that those non-closed "polygons" afterwards in Godot really work flawless e.g. as collision objects (from all sides)? I'm quite unsure about that.

mark-rafter commented 9 months ago

It works fine, what behaviour were you expecting?

https://github.com/Kiamo2/YATI/assets/38855689/c554609f-1cb3-4e4f-8ef3-f8d711c5bc64

Kiamo2 commented 9 months ago

If it works fine, ok. You've convinced me.