Defold polygon editor not allow to create polygon with internal angles.
imagine that I need to add the complex physics object like hydrocycle:
the first, in Physic Editor I do vertices:
then save in format for PhaserJS, look like:
"boat6": [
{
"shape": [ 108,44, 45,98, 8,66, 28,51, 107,3, 128,18 ]
},
{
"shape": [ 206,107, 189,69, 211,52, 228,52, 243,74 ]
},
{
"shape": [ 137,69, 45,98, 108,44 ]
},
{
"shape": [ 137,69, 189,69, 206,107, 45,98 ]
}
]
second, I wrote the script to convert this data to needed format:
(need a flip Y coordinates top down)
shape_type: TYPE_HULL
data: 108
data: 63
data: 0.0
data: 128
data: 89
data: 0.0
data: 107
data: 104
data: 0.0
data: 28
data: 56
data: 0.0
data: 8
data: 41
data: 0.0
data: 45
data: 9
data: 0.0
(the first polygon, for example)
and save it as part1.convexshape and add it as collision shape.