When angular limits are applied to all 3 axes for a Havok 6DOF Joint, and the child body is pushed with an impulse, the simulation seems to blow up and all limits are broken.
Please see the Youtube video below where I show the issue. At first, angular limits are only applied to 2 axes, and the simulation abides by the limit and appears fine. After applying an angular limit to the 3rd axis, the simulation blows up and all limits are broken.
However, if you didnāt edit the direction of the impulse, itās strange how the green box is rotating around the X-axis in your picture when the impulse was in the X-direction
Thanks for the report. Thatās definitely not behaving the way I expect. Looks like the problem is in our Babylon integration layer, as the same configuration behaves much better in our lower-level SDK. Looks like I have some debugging to do .
Iāve begun referring to the Havok Plugin, by which I mean the HavokPlugin class, and the Havok Engine, by which I mean the wasm and its lower-level typescript classes accessible through havokPlugin._hknp.
By āintegration layer,ā are you referring to the Plugin or to the typescript in the Engine?
This will be fixed in version 1.3.10 of the ā@babylonjs/havokā package.
In this case, the problem turned out to be in the WASM. To complicate naming-matters further, the interface exposed through the WASM is a thin layer which sits on top of the ārealā Havok engine
Awesome. What you call āintegration,ā I think I had included that in āEngineā. I like your terminology better.
I have been working on a set of Physics Debug visualization classes and it seems beneficial for me to indicate which layer each of those classes digs into.
Iāve been calling these:
Plugin ā Engine (everything not Plugin)
I think you referred to:
Plugin ā Integration ā Engine?
I kind of prefer:
Plugin ā Integration ā Interface ā Engine What do you think?
The npm package linked below refers to that returned by HavokPhysics the āinterfaceā. I canāt quite tell if this is consistent with my preference.
In my preference above, Plugin and Integration are provided by Babylon while Interface and Engine are provided by Havok. My interest in defining these at all is to provide documentation for my debug visualization.
Short name (type) - access (more info)
Plugin (HavokPlugin) - returned from constructor ānew HavokPlugin(ā¦)ā (doc) (code)
Well, naming things is hard and I donāt have all the answers
Just a minor correction on your info:
Here, items 2, 3 and 4 are all the same thing - HavokPhysics.d.ts is just type definitions for the WASM - it only provides some niceties in your IDE; not any code. The JS files in item 3 are just some loading code which handles the environment and initialization of the WASM. Item 4 is the actual implementation. The underlying C++ Havok interface isnāt exposed - the WASM exposes only a simplified, (much) easier-to-use, thin wrapper around the C++ Havok SDK. While itās intended to be quite generic, the functionality exposed is designed with Babylon in mind. Essentially, this interface is glue code between JavaScript and the C++ Havok SDK. While there isnāt really any āuser manualā documentation for this layer, the HavokPhysics.d.ts does try to document the functionality.
Item 1, is how Babylon integrates with that Havok interface. It provides the glue code between the Babylon types (PhysicsBody, etc.) and the implementation in items (2,3,4).
Thank you for the thorough explanation. Thank you for your time in detailing what is already in the āUsing Havok and the Havok Pluginā document.
I had thought that the havok engine itself is C++ compiled into WASM. And your explanation still makes sense. I can understand what you are saying by looking at package.json and rereading āUsing Havok and the Havok Pluginā
The first is the Havok engine itself, which is a WebAssembly module that is responsible for the actual physics calculations. The second is the Babylon Havok plugin, which is responsible for the integration of the Havok physics engine into Babylon.js.
The āstackā is essentially:
HavokPlugin which pulls everything below through constructor parameter hpInjection:HK
TypeScript definitions of exposed narrow interface to HavokPhysics (HavokPhysics.d.ts, āHavokPhysicsWithBindingsā)
Exposed (narrow) Interface to WASM Havok code (from HavokPhysics_es.js HavokPhysics_umd.js with name HavokPhysics)
WASM Havok code
Further, Iām guessing that 2, 3, and 4 are automatically derived from C++ source wrapped around the Havok SDK to the Havok Engine. And all C++ code (narrow interface, SDK, and the Havok Engine itself) is compiled into WASM.
So the āintegrationā code you were referring to was the HavokPlugin (aka āPluginā), with this source code (dev) and the constraints issue you found was in the WASM Havok code?