Custom 3D collision shape

Three symbols fixed the fundamental bug! Thank you, this is awesome! :blush:

7 Likes

@aglitchman Can you describe how you converted your mesh to the .convexshape? I tried exporting a .dae from blender and copying the “mesh-positions-array” (splitting each coordinate up into lines, etc), but I just got a twisty mess. I tried reversing the order of the vertices, but no luck with that either.

screenshot_2021-06-29_22-25-58

Pkeod’s original cube is also twisted, but Astrochili’s pyramid works fine.

1 Like

Sorry for the late answer but I can give it now.

It’s not very important to have a correct order. For bullet physics the convexshape is a set of vertices without any order or grouped faces.

Only the engine tries to draw the convexshape with green lines from the first vertice to the second, from second vertice to the third etc. So the only reason to keep the order and assemble the array, for example, by going through all the triangles one by one, is for visual debugging.

My pyramid is fine because I prepared it this way by adding 3 vertices per a triangle → 4 triangles → 12 vertices. But in this case just 5 vertices would also work for physics, albeit with messy lines in debug drawing.

5 Likes