Counter part to Havok.getBodyGeometry?

Hi everyone,

We have HavokPlugin.getBodyGeometry. I was hoping to find something like “ReBuildShapeFromGeometry()” or so. Is there a private function I missed somewhere?

Otherwise, there is a workaround* via instantiating a BABYLON.Mesh and then feed this mesh to the PhysicsShape constructor again. But will this roundtrip cause additional memory allocations? Or will Havok re-use the position/index buffers?

FYI use case: On first load, all meshes are merged. Just before that, individual meshes are send to Havok to build their shapes. Individual meshes get disposed. Iding is done via TransformNodes. Later, on re-loading the scene, the big merged mesh is restored - all the invidual meshes are gone.

Best wishes
Joe

*the playground doesnt make any sense; it is just for demoing serializing/parsing a physics shape

Regenerating a new shape may be the best approach.

You may have already seen this old post of mine (near the end of that post).

But also consider constraining separate meshes. When doing so, you can tell Havok to ignore collisions between constrained bodies. It is nominally a rigid constraint but there is sometimes a little “give.” You’ll have to construct the meshes and try it out to see if it works for you.