Havok - is it possible to write updates to internal memory buffers?

Hi, I would like to know if it’s possible to write directly to memory with the havok physics engine, I’d imagine its similar to ammo.js in that it’s wasm binary is using a float32 array for storage or some other array buffer object. I’m particularly interested in writing directly to it in certain contexts where it’s faster for the gpu to make mass updates.

let me add @Cedric to the thread

It’s what is being done when using instances:

with a float copy from Havok to matrix data


Hi @Cedric. For some reason I missed the notification from your reply. Thank you for pointing me to that example. In this code snippet we see reading the data internally from the havok engine.
I wanted to confirm - if we update that same data, such as applying an update to the position elements of a rigid body world transform, will the havok physics engine treat that as the new source of truth?

Thank you!

I didn’t read correctly your post actually. You want to mass update Havok internal datas from GPU computation.
I understood the inverse and I would not do what you want to do.
Havok internal, structure, computation pipeline might change and I’m not even sure the produced matrix is reused for the next frame.
But, I would suggest, for the bodies you are responsible of the dynamics, to swtich them to Kinematic/motion, do the update on your side and enable prestep so matrix info from Babylon to Havok is taken into account.

Okay, when I get around to testing this out, I’ll report back here. If it works, great, we know that what ever version I test with this is a viable mass update method, if not lesson learned!

1 Like