According to Havok’s .d.ts types, MotionType is an enum, however, HP_Body_SetMotionType() actually requires an object of form { value: number } for MotionType. It’s a bit challenging to use Havok functions like these with strict Typescript typing.
I found this smart workaround by Namide that works for me. He intersected the enum’s with HavokPhysicsWithBindings:
Is there a change on Babylon’s side we could make to make Havok more convenient to use out of the box when using strict TypeScript, i.e. not having to write and maintain this large intersection object ourselves?
Would you be able to reproduce ths issue in a simple typescript project? I am trying to udnerstand the actual problem here. i.e. - is it a types issue, or a js issue? The function can expect something, which is fine, but if the types are aligned, it shouldn’t fail on typescript.
A reproduction would be great, to allow me to check what can be done. We will be happy to fix it on our side.
My mistake, all. I was using an older version of @babylonjs/havok. Since version 1.3.4, these enum’s were added to HavokPhysicsWithBindings, so I believe this is resolved