It seems to me that the following collision shapes from png are wrong for many tiles…
While a few could be a better fit (with s better algorithm), please note that the shapes should be convex. You have many concave shapes there.
@Mathias_Westerdahl Yes, the computed shapes must be convex. But for quite of them the shape is far from the convex hull. Consider for example the tile in the second row, 6-th column, why a vertex in the left top corner?
Is there anything I can do (to the png) to improve the result of the shapes?
Thanks as usual!
Short answer, I don’t know.
Either the data is not completely transparent, or there’s a quirk in the algorithm (very likely)
Mathias, thank you again.
I have checked the png with Krita by separating the color and alpha channels and everything looks fine to me.
Is there a way to edit by hand the shapes? or may I somehow provide a text file with the shapes?
Related question. When I use the collision shapes with a tilemap, are the shapes of the tiles just put side by side? Or the union of the shapes is decomposed in convex shapes? Let me make an example.
Suppose I have two adjacent square tiles in the tilemap. The colliding shape is a rectangle or a union of two squares? in the second case this can cause a problem; for example if a character walks over the two squares it will stumble in the adjacent vertices of the two squares. (I hope this makes sense…)
Thank you in advance!
Ciao!
They are put side by side. You should be able to see this when you enable physics debugging.
@britzl thank you!
However here Platformer Defold tutorial the contrary is claimed… Maybe this is no more true?
Yes, I remember it being a problem with falling through the geometry, so we did some changes.
The tilemap physics is something we’d like to improve upon next year (our informal roadmap).
Thanks Mathias!