I know custom shapes have been requested for collision calculations. What about for now a triangle shape?

Bullet physics has a btConvexHullShape class included. Would the effort mostly be in validating the buffer specified matches the definition of a convex hull?

the b2PolygonShape and btConvexHullShape are the ones to target in that case yes.

Well, it’s also about supporting setting a buffer resource to the collision component. And making sure it gets built with the editor/bob. And support setting it at runtime. You can compare with the Mesh component.

Would it be easier to do it in two separate phases. Maybe just support setting a Mesh shape for a Collision Object in the editor first. Then if that works, then add support for dynamically setting it via code after? Or would it be better to just design it to be dynamic from the get-go?

I would say it’s easier the other way around, since the engine code still needs support for the buffer code.

Also note, that it’s not a mesh per se that you want to support, since that’s for visual purposes, but rather the buffer format.

Just a reminder for you that this is not a small task, and it’s fairly advanced.
You should definitely create a design document where you put down design questions, where we can assist in reviewing. The more guidance we can do upfront, will save you/us time down the line.

2 Likes

Are there any good docs on the buffer format out there I can start by investigating? I know there’s a blender plugin for exporting buffers but a document that clarifies the format and explains how to generate them would be most beneficial.

The documentaiton pages for the usage of the buffers are here:
Lua: https://defold.com/ref/stable/buffer/
C++: https://defold.com/ref/stable/dmBuffer/

The buffer format is very much like a vertex buffer.

1 Like

https://github.com/LyuRongjian/glb2convexshape
I’m try to get all triangles from a GLB file, and pack into a collision group, so it can get a matched collision model. Every triangle will create a convexshape file.

3 Likes