A complex body plugin (arbitrary-sized, non-convex and editable RigidBody).
Warning: This is WIP. Really.
It works, but...
1. If you change the position, the scale or the rotation of the ComplexBody object, weird things happen when editing the body. The XYZ transformation is not right.
2. The texture management is as far from good as it can be. I'm thinking of rotating each triangle texture based on the rotation of the previous triangle, but first I wanted to finish the editor plugin, and I'm loosing my mind
3. The vertex sort order could be modified to something better.
4. The code should be cleaner.
How it works:
To edit a ComplexBody it must be selected (green lines) AFTER entering the ComplexBody Editor.
Left click to move or add a vertice.
Right click to remove a vertice.
Ctrl to show the snap lines.
When a vertex is added, it is ordered based on the proximity of the other vertices.
Here is the code: https://github.com/YMRYMR/YMR.ComplexBody
You are welcome to try it and help (or change everything)
PS: The ear cutting triangulation code
is the work of fgshen
, and the correction
code is the work of gomezmateu.oscar
. They did the real magic.