How to calculate pivot of constraint when using havok

Playground: https://playground.babylonjs.com/#KMGUZY#4.

I’m not sure if it is a bug but the behavior is really out of my knowledge.

In the playground, I added a green parent and a red child, they all in a parent node with a simple gltf parent node, and notice it will not change y coordinate values.

Then I set the constraint with all angles and distance to be locked. The pivotA is (0, 10, 0) and pivotB is (0, 0, 0). So for what I understand, after physics, we should get the same world coord of pivotA and pivotB, which means the red child is above, but the behavior is the opposite. However, if we comment the parent node part, things works well.

I was wondering what I’m doing wrong, or anything that I misunderstood?


Edit: I also encoutered some similar problem when calculating the center of a transformNode that I have to mutiply -1 on y coord to get the correct result, I guess they are the same issue?

cc @Cedric our physics expert but please bear with us until next year :wink:

For calculating center part, I find the reason is absoluteScaling.

I may misunderstand things about local, this playgound should explains better: https://playground.babylonjs.com/#KMGUZY#7

Yes, root of the issue (at least a part of it) is the absoluteScaling. More specifically the negative component.

options.center is not correct but its fix should not be too complex.

The parenting & non uniform scaling need more work to understand it

As center is passed to havok wasm directly, is this means the wasm have the same issue? If so, will it be updated recently so I can kick my ugly quick fix to scale y with -1 away?