Hey guys, Its been a long time. I just got back into a bit of hobby development.
I’ve taken up replacing my own collision-detection / physics modules with the JME jBullet library, but I’ve run into a problem.
I have a block terrain that I want to create collision shapes for, for that I would like to use the terrain data directly - currently the only way I can think of to generate the collision models is by generating BoxShapes for every ‘block’, which will be way to memory consuming (is my guess).
Does anyone have experience / knowledge of implementing a custom collision shape within the jBullet framework? Maybe even for a blocky terrain?
What about the existing options like mesh shapes, hull shapes or heightmap shapes is insufficient?
Using a mesh shape should be fine, you would have multiple geometries consisting of parts of the block world anyway (as I hope you don’t just batch blocks to make your block world).
No, my world is propperly chunked and divided into regions ect.
A height map wouldn’t do the trick as my terrain is more more complex. I haven’t read into hull shapes - guess I’ll check it out.
I tried using a MeshCollisionShape, and it worked - no performance issues at all. Which is quite surprising to me… I hadn’t even bothered trying, since I was pretty sure it would be too heavy - but nope, it runs smoothly.
I guess I could optimize it by loading / unloading collision models based on distance to dynamic entities - but that is icing on the cake for now.
Ty for the suggestion, I guess I needed to hear it from someone else.