Maybe using of Chain Shape may help here Add Chain Shape for box2d · Issue #8505 · defold/defold · GitHub
It could be importing the .convexshapes file that is exported from PhsysicsEditor with the above helper scripts. It’s the list of .convexshape files in a single file.
shape_type: TYPE_HULL
data: 213
data: -149.5
data: 0
data: 212.5
data: 151
data: 0
data: 83.5
data: 85
data: 0
data: 72.5
data: 77
data: 0
data: -213.5
data: -150
data: 0
shape_type: TYPE_HULL
data: -212.5
data: 151
data: 0
data: -214
data: 150.5
data: 0
data: -213.5
data: -150
data: 0
data: -73.5
data: 74
data: 0
data: -95.5
data: 90
data: 0
data: -211.5
data: 151
data: 0
shape_type: TYPE_HULL
data: -165.5
data: 143
data: 0
data: -190.5
data: 150
data: 0
data: -211.5
data: 151
data: 0
data: -95.5
data: 90
data: 0
data: -120.5
data: 113
data: 0
data: -140.5
data: 129
data: 0
shape_type: TYPE_HULL
data: 196.5
data: 151
data: 0
data: 178.5
data: 148
data: 0
data: 162.5
data: 143
data: 0
data: 145.5
data: 135
data: 0
data: 123.5
data: 120
data: 0
data: 83.5
data: 85
data: 0
data: 212.5
data: 151
data: 0
shape_type: TYPE_HULL
data: -73.5
data: 74
data: 0
data: -213.5
data: -150
data: 0
data: -53.5
data: 64
data: 0
shape_type: TYPE_HULL
data: -53.5
data: 64
data: 0
data: -213.5
data: -150
data: 0
data: -37.5
data: 59
data: 0
shape_type: TYPE_HULL
data: -37.5
data: 59
data: 0
data: -213.5
data: -150
data: 0
data: -20.5
data: 56
data: 0
shape_type: TYPE_HULL
data: -20.5
data: 56
data: 0
data: -213.5
data: -150
data: 0
data: 14.5
data: 56
data: 0
shape_type: TYPE_HULL
data: 14.5
data: 56
data: 0
data: -213.5
data: -150
data: 0
data: 35.5
data: 60
data: 0
shape_type: TYPE_HULL
data: 35.5
data: 60
data: 0
data: -213.5
data: -150
data: 0
data: 52.5
data: 66
data: 0
shape_type: TYPE_HULL
data: 52.5
data: 66
data: 0
data: -213.5
data: -150
data: 0
data: 72.5
data: 77
data: 0
Supporting this would improve workflow of using PhysicsEditor for these kinds of special collision shapes.
I feel it is still important so in the future I will put up some paid bounties for anyone to improve it. You guys were talking about making the currently builtin physics made into a normal extension too, please remember the Chipmunk extension when you try to normalize things for various physics extensions in the editor.
A spline sprite shape + ability to use it for physics would be nice.
So many 2D specific features Defold is missing! They even have the sprite → collision shape right there, and you can even adjust the points on the fly.
True. Can’t recall why I did not use it tbh.
I’m still in the prototype/experiment stage (read having fun!). Will revisit later but even with this I would still have to provide an executable to launch from an editor extension since that API is not available to editor scripts.
We’ve just added support for Defold to PhysicsEditor.
You can find a short tutorial here: https://www.codeandweb.com/physicseditor/tutorials/how-to-create-physics-shapes-for-defold
PhyicsEditor splits complex shapes (concave polygons) into convex polygons and you can easily add them to a single game object.
This works well for static and possibly kinematic objects.
Dynamic objects don’t really work. The problem is that the collision objects in a single shape create internal forces that make the object move randomly. There’s currently not much we can do about that since Defold does not support using multiple polygons in a collision object.
What we would like to see is a new collision object file in which we can
- Add multiple circle and/or polygon shapes
- Set independent parameters for each of the shapes
This would allow box2d to work properly with the physics shapes.