Pooling HardonCollider shapes

I use a script to create HardonCollider shapes at the same time as I create the game object instances with a factory. The shape creation is too CPU intensive, so I was thinking of pooling them, when I remembered that Defold has magic pooling for game objects under the hood. So, the question is:

If I create the shape on the game object’s “init”, and delete it on “final”, will it be part of Defold’s internal pooling?

How do you create them? Defold preallocates arrays for game objects, sprites and other components to efficiently create, delete and update them. This system doesn’t extend to anything you might create from a Lua module or native extension. It is likely that you have to pool them yourself.

1 Like

Okay, yeah that’s what I thought. Otherwise it would have truly been magic! Gives me an excuse to make a minimal pool module too. Such fun!

2 Likes